Working in Linux with the bash Shell - dummies

By Emmett Dulaney

Part of Linux All-in-One For Dummies Cheat Sheet

The bash shell serves as the mediator between the user and the Linux kernel, with bash being the most common shell in use today. To interact with the bash shell, you need to understand how the pipe works (allowing the output of one command to be the input of the next), how to use redirection, and some basic commands and environment variables:

  • Pipe:

    • command1 | command2

  • Redirections:

    • command > file: output goes to file

    • command < file: input from file

    • command >> file: append to file

    • command2> file: errors go to file

  • Commands:

    • alias: Defines a shortcut for a long command

    • apropos: Searches the manpages for keywords

    • history: Displays the most recent commands

    • locate: Finds files

    • whereis: Finds executable files for a command

    • which: Shows the full pathname for a command

    • man: Displays online help

    • printenv: Displays the environment variables

  • Environment variables:

    • HOME: User’s home directory

    • PATH: Directories to search for commands

    • TERM: Name of a terminal type