Over a million developers have joined DZone.

Time Saving Bash Tricks

· DevOps Zone

Download “The DevOps Journey - From Waterfall to Continuous Delivery” to learn learn about the importance of integrating automated testing into the DevOps workflow, brought to you in partnership with Sauce Labs.

This is a followup from the lightning talk '5 Time Saving Bash Tricks' at DevOpsDays, Bangalore 2011.


These work with the emacs-readline, which is the default configuration in most ditributions (including OS X).

  • C means Control
  • M means Meta (usually mapped to Alt/Option or Escape on QWERTY keyboards.)


View more presentations from hyfather 
`M` stands for the Meta key. Commonly represented by the Alt/Option/Esc key on your keyboard.
`C` stands for the Control key.
Example -- `C-k` means 'hit `k` while keeping `Control` pressed.'
Yank the last argument to the previous command.
Yank the first argument to the previous command.
`C-k, C-w, M-d, C-u`
All these kill text in different ways and save it in the kill-ring.
Yank most recent item from the kill-ring.
Immediately follows a `C-y`. Cycle through the kill-ring.
Substitute the previous command (e.g. `sudo !!`)


SSH multiplexing



Host *

ControlMaster auto

ControlPath /tmp/%r0%h:%p



Ensuring Bash Hisory across multiple sessions


shopt -s histappend


Remember to use pushd and popd when in deeply nested directories.


Background tail processes to share STDOUT and STDERR with any REPL (including the shell itself.)

tail -f httpd.log &

Then start the REPL, or continue working on the shell. 

 Source:  http://blog.hyfather.com/time-saving-bash-tricks

Discover how to optimize your DevOps workflows with our cloud-based automated testing infrastructure, brought to you in partnership with Sauce Labs


Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}