/ factorpad.com / tech / linux-cheat-sheet.html
An ad-free and cookie-free website.
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.
The seven sections below include:
If we're missing something you'd like to see, reach out to us on social media.
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 filesLinux 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
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
|
&
;
(
)
<
>
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 lineReserved 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
constructPermissions 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 |
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 |
The FactorPad YouTube Channel is growing every day. Don't miss out. Subscribe now. Also, follow @factorpad on Twitter if that's how you like reminders, or try out our no-spam email list.
/ factorpad.com / tech / linux-cheat-sheet.html
A newly-updated free resource. Connect and refer a friend today.