Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Cracking the Shell: Command-line for the Drupaler

Cracking the Shell: Command-line for the Drupaler

Wouldn’t it be nice if you could type one command that booted your vagrant box, started displaying watchdog logs, set up the correct Drush alias, and provided easy access to your remote servers? Sounds nice, right? Or maybe you use tools like Grunt, Gulp, or Sass. What if you could launch all of your tools for a project with one command? In this session attendees will see how to use the terminal every day to get work done efficiently and effectively. We will discuss an array of command line tools and how you can set up a very efficient workflow for your projects.

Who is this session for?

Anyone that uses the command line or wants to use it more effectively. This talk will have something for everyone from beginner to advanced.

See example gif in new tab.

You’ll Learn:

How to use free command line applications to get work done.
How to better use the command line tools you already know.
How to customize your command line to behave the way you want it to. I guarantee attendees will walk away with at least one new tip, trick, or tool.

Topics

Why you should invest time in learning command line tools.
Switching projects quickly.
Keeping your projects separated.
Git tips and tricks.
Building your own shell based IDE.

Some of the tools I will cover

Dotfiles
Shell aliases and functions
Tmux and Tmuxinator
Git tips
Tig
Drush
Drupal Console
Vim as an IDE

Speaker bio

Bob is a Lead Architect at Mediacurrent who has been slinging Drupal code for ten years. An active member of the Drupal community, Bob manages the Fresno, California Drupal User’s Group, belongs to the Drupal Association, and is the editor of the TheWeeklyDrop newsletter.

drupalcon

April 22, 2018
Tweet

More Decks by drupalcon

Other Decks in Programming

Transcript

  1. Mediacurrent is a full-service digital agency that implements world class

    open source software development, strategy and design to achieve defined goals for enterprise organizations seeking a better return on investment.
  2. What is the Shell? What is the Shell? A shell

    is a user interface for access to an operating system's services.
  3. Strengths of the CLI Strengths of the CLI Light on

    Resources Concise Scriptable for Automation
  4. Why you should learn to use the Shell Why you

    should learn to use the Shell
  5. 67.8% to 98.3% of the Servers on the Net are

    using Unix or 67.8% to 98.3% of the Servers on the Net are using Unix or Unix like systems Unix like systems
  6. Making the most of Dotfiles Making the most of Dotfiles

    Symlink to a single directory Track in Git You can take your customizations with you. Look at other dotfiles and steal liberally Add small bits at a time and learn how to use them
  7. What configuration do we add to our dotfiles repo? What

    configuration do we add to our dotfiles repo? ~ My Dentist (Probably stole this line) Only floss the teeth you want to keep.
  8. The Shell The Shell : the GNU Project's shell and

    is what I use. : a shell designed for interactive use, although it is also a powerful scripting language : a smart and user-friendly command line shell for OS X, Linux, and the rest of the family. Bash - gnu.org/software/bash ZSH - zsh.org Fish - fishshell.com
  9. Environment / $PATH Environment / $PATH Add things to your

    path export PATH=~/bin:/usr/local/bin:/usr/local/sbin:/usr/bin # Type $ someapp # Instead of $ ~/some/dir/drush/someapp.php en.wikipedia.org/wiki/PATH_(variable)
  10. Aliases Aliases Shortcuts for longer more complex commands. alias h='history'

    alias l='ls -lhGt' # -l long listing, most recen alias g='git status'
  11. ~/.ssh/config ~/.ssh/config Save yourself from trying to remember IP addresses

    and port numbers Host server1 HostName 192.168.68.122 User napolean Port 22 Host server2 HostName 192.168.68.123 User kip Port 22
  12. Privacy and Security Privacy and Security Don't put sensitive info

    in your Git repo if you plan to make it public.
  13. Ignoring files Ignoring files Per machine: ~/.gitconfig Per project: .gitignore

    file in the repository Per repo instance: .git/info/excludes
  14. Git Hooks Git Hooks .git/hooks Customizing Git - Git Hooks

    git-scm.com/book/en/v2/Customizing-Git-Git-Hooks
  15. Post commit Post commit Do tasks like copy your commit

    message to your clipboard? #!/bin/bash # Copy last commit message copied to clipboard git log --pretty=format:"%s %n%b" -1 HEAD | pbcopy
  16. But I forget to add those to my repo But

    I forget to add those to my repo
  17. .git_template .git_template In your ~/.gitconfig [alias] init = init --template

    ~/.git_template [init] templatedir = ~/.git_template A good tutorial for setting this up. Logging Git commits with doing. brettterpstra.com/2014/03/20/logging-git-commits-with-doing
  18. Git HUD Git HUD A heads up display for your

    Git repos. github.com/gbataille/gitHUD
  19. Why Vim? Why Vim? I plan on coding for many

    years (What editor was hot two years ago again?). I'm already in the shell. Open source and available on all systems. It will NEVER die. I love using the keyboard (Vim is designed for the keyboard first).
  20. Plugins of Note Plugins of Note Vim Fugitive - Git

    Gitgutter - Git Vdebug - Debugging Vim Surround Vim Plugin For Drupal
  21. Vim Fugitive - Git Vim Fugitive - Git A Git

    wrapper so awesome, it should be illegal. github.com/tpope/vim-fugititve
  22. Vdebug - Xdebug Client for Vim Vdebug - Xdebug Client

    for Vim github.com/joonty/vdebug.git
  23. Drush Drush Fast local server Download and enable modules Backup

    and import databases Perform updates Watch logs Log in as any user and much much more!
  24. Drush aliases Drush aliases Drush commands against a specific Drupal

    site, even remote sites. drush @youralias somecommand -y drush use @youralias drush updb -y
  25. Another CLI for Drupal. Generate boilerplate code Interact with and

    debug Drupal. Drupal Console Drupal Console drupalconsole.com
  26. Tmux - Bringing it All Together Tmux - Bringing it

    All Together tmux is a terminal multiplexer
  27. Seriously, Why Seriously, Why Detach and attach to terminal sessions

    without loosing state. Isolate your terminal sessions. Script terminal session layout based on project needs.
  28. Resources Resources My Dot files - github.com/kepford/dotfiles dotfiles - Unofficial

    guide to dotfiles on GitHub (dotfiles.github.io). ShellDevel - shelldevel.net Craft your own IDE in the shell - Wynn Netherland - (vimeo.com/84183973)
  29. Git - Resources Git - Resources Git Ready - gitready.com

    Learn Git branching - pcottle.github.io/learnGitBranching/ Got 15 minutes and want to learn Git? - try.github.io Git precommit hooks - github.com/andrewmriley/drupal-site-precommit
  30. Vim - Resources Vim - Resources Vim Casts - vimcasts.org

    Learning Vim in a Week - mikecoutermarsh.com/boston-vim-learning-vim-in-a-week Let Vim Do the Typing - youtube.com/watch?v=3TX3kV3TICU Vim adventures - vim-adventures.com VimGolf - vimgolf.com
  31. Tmux Resources Tmux Resources Efficient Drupal Development with Tmux and

    Tmuxinator Tmux - Upcase - Paid but worth the cost. A Tmux Crash Course
  32. What Did You Think? What Did You Think? Locate this

    session at the DrupalCon Nashville website: https://events.drupal.org/nashville2018/sessions/cracking-shell-command-line-drupaler Take the Survey! https://www.surveymonkey.com/r/DrupalConNashville Cracking the Shell Cracking the Shell