Advanced command line techniques

Despite being text-based, the bash shell is a very sophisticated and powerful user interface.

Note

There are many shell programs, of which bash is the most common. Different shells have different capabilities and syntax, and the following material is specific to the bash shell. If you use another shell (e.g. tcsh or zsh) some of these techniques will likely not work.

These short tutorials cover some of the more useful capabilities of the bash shell, but are hardly exhaustive.

There are many guides and tutorials online for more comprehensive study, just a few:

Part 1

  • pipelining
  • silencing stdout and stderr with /dev/null

Runtime: ~10 min

Part 2

  • aliases - user-defined shortcuts for longer commands
  • environment variables - text values stored in variables
  • shell expansion - construct commands by string substitution and special syntax
  • ~/.bash_profile and ~/.bashrc

Runtime: ~10 min

Part 3

  • the history command
  • history scrollback
  • history search (Ctl-r)

Runtime: ~4 min