FactorPad
Faster Learning Tutorials

Linux Cheat Sheet and Command Line Reference

The brain can only remember so much. So we cheat.
  1. Command line - Memorize about 50 commands and find reference material for the rest.
  2. Bookmark - Access go-to resources to stop wasting time searching the Internet.
  3. Structure - Stay organized and you will become a master of the Linux command line.
Paul Alan Davis, CFA, January 2, 2018
Updated: December 10, 2018
Skip those one-page pdf cheat sheets, they're too cluttered for the beginner.

Outline Back Next

~/ home  / tech  / linux cheat sheet


What's Covered Here?

Beginner

This Linux cheat sheet was originally created for the Linux Essentials course covering 100 commands for the beginner. That tutorial series includes web pages with code examples and links to 3-4 minute videos on our YouTube Channel.

Sections of this Document

The seven sections below include:

  1. A Standard Linux Directory Structure
  2. Commonly Used Wildcards
  3. Metacharacters
  4. Keystroke Combinations
  5. Reserved Words
  6. File and Directory Modes and Permissions
  7. Non-Alphanumeric Characters and Meanings

Linux Cheat Sheet

If we're missing something you'd like to see, reach out to us on social media.

A Standard Linux Directory Structure

Below is a reference to the basic structure of directories for most Linux distributions. Find more at the Linux Filesystem Hierarchy Standard, on Wikipedia.

  • / - the root or base of the filesystem
  • /bin - operating system binaries
  • /boot - Linux kernel and programs run at startup
  • /dev - devices
  • /etc - system configuration files
  • /home - user working directories
  • /lib - library files shared across installed programs
  • /media - removable media devices
  • /mnt - removable device mount points
  • /opt - for optional software
  • /proc - Linux kernel files
  • /root - home directory for root user
  • /sbin - system binaries
  • /usr - program and support files
    • /usr/bin - programs installed by the Linux distribution
    • /usr/lib - shared libraries
    • /usr/local - programs for system-wide use
    • /usr/sbin - system administration binaries
    • /usr/share - shared data used by programs including documentation
  • /var - dynamic data, including mail, databases and log files

Commonly Used Wildcards

Linux offers extensive search capabilities using wildcards and the following characters are frequently used.

  • * - matches any character
  • ? - matches a single character
  • [set] - matches a set of characters
  • [!set] - matches those not in the set

Metacharacters

These 10 metacharacters have special meaning to the bash shell program and must be quoted with ' or " to not be interpreted as metacharacters.

space  tab  newline  |  &  ;  (  )  <  >

Keystroke Combinations

These keystroke combinations are helpful in the bash shell.

  • Ctrl-c - stop a process
  • Ctrl-d - exit the terminal
  • Ctrl-z - pause a process
  • Ctrl-a - go to start of line
  • Ctrl-e - go to end of line

Reserved Words

Reserved words are commonly used for looping and conditional constructs when writing functions and scripts.

  • ! - negation or not
  • [[ ]] - conditional expression
  • { } - command grouping
  • function - define a function
  • select do done - create a menu
  • time - for timing statistics
  • case in esac - conditional construct
  • if then elif else fi - conditional construct
  • for in do done - looping construct
  • until do done - looping construct
  • while do done - looping construct

File and Directory Modes and Permissions

Permissions can be set with any one of three modes: octal, binary and mode.

Octal Binary Mode
0 000 ---
1 001 --x
2 010 -w-
3 011 -wx
4 100 r--
5 101 r-x
6 110 rw-
7 111 rwx

Non-Alphanumeric Characters and Meanings

The following 32 non-alphanumeric characters have special meaning in the bash shell depending on context. The Context Key below is used to cross-reference the context under which each character has special meaning. See GNU Bash Manual for more complete information.

Symbol Name(s) Context
` backtick I
~ tilde M
! exclamation, bang O, S
@ ampersand, at symbol H, O
# number, pound, sharp, hash B, H
$ dollar symbol H, I, L, O, Q, S
% percent J, H, U
^ caret H, J
& ampersand, and symbol D, J
* asterisk, star J, H, L, O
( open parenthesis H, J, S
) close parenthesis H, J, S
_ underscore (no special meaning)
- dash, minus, hyphen J, M, O, S, U
+ plus J, O, P, U
= equal J, Q, R, S
| pipe, vertical bar D, J
\ backslash I, T
/ forward slash J, H, M
{ open brace, curly bracket F, H, S
} close brace, curly bracket D, H, L, O, S
[ open bracket D, H, L, O, S
] close bracket D, H, L, O, S
" quote, double quote A, P, S, T
' apostrophe, single quote A, O, P, S, T
: colon C, F, H, S, T
; semi-colon E, S
? question mark O
< less than D, N
> greater than D, N
. period, dot C, M
, comma J
Context Key
  1. quoting
  2. comments
  3. command shortcuts
  4. redirection
  5. compound commands
  6. brace expansion
  7. tilde expansion
  8. parameter and variable expansion
  9. command substitution
  10. arithmetic expansion
  11. word splitting
  12. filename expansion
  13. directories
  14. process substitution
  15. pattern matching
  16. command options
  17. environment
  18. variables
  19. expessions
  20. escape sequences
  21. job control

Related Content


What's Next?

The FactorPad YouTube Channel is growing every day. Don't miss out. Subscribe now.

  • To see the outline for Linux Essentials, click Outline.
  • To see other Technology content, click Back.
  • To learn what else we publish on Linux, click Next.

Outline Back Next

~/ home  / tech  / linux cheat sheet



 
 
Keywords:
linux cheat sheet
linux reminder
linux find help
linux directory hierarchy
linux keywords
linux characters
linux bash
linux command line
linux special characters
linux reserved words
linux keystroke combinations
linux metacharacters
linux modes and permissions
linux video tutorial