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 processCtrl-d
– exit the terminalCtrl-z
– pause a processCtrl-a
– go to start of lineCtrl-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 groupingfunction
– define a functionselect do done
– create a menutime
– for timing statisticscase in esac
– conditional constructif then elif else fi
– conditional constructfor in do done
– looping constructuntil do done
– looping constructwhile 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
- quoting
- comments
- command shortcuts
- redirection
- compound commands
- brace expansion
- tilde expansion
- parameter and variable expansion
- command substitution
- arithmetic expansion
- word splitting
- filename expansion
- directories
- process substitution
- pattern matching
- command options
- environment
- variables
- expessions
- escape sequences
- job control
!External content + my content! – source link https://factorpad.com/tech/linux-cheat-sheet.html