Cheatography
https://cheatography.com
Module 1 of RHCSA including: Installing Redhat, Essential Tools, File Managment Tools
This is a draft cheat sheet. It is a work in progress and is not finished yet.
Essential Commands
pwd |
Show current working dir |
whoami |
Show current username |
ls |
List files in dir |
ip addr show |
Show current IP config |
free -m |
Show how much memory you have |
df -h |
Show available diskspace |
cat /etc/hosts |
Show contents of file |
findmnt |
Show mounted file system |
|
|
Linux File System Hierarchy
Note |
Highly standardised, defined in FHS, maintained by Linux Foundation, starting point is root dir, other devices may be intergrated in FHS using mounts |
/ |
root dir, mounted on the name of device |
/boot |
Boot dir |
/home |
Home Dir |
/var |
Variables dir |
|
|
Globbing
* |
Any character |
? |
Only 1 character |
[hm] |
Either h or m |
[!hm] |
Neither h or m |
[0=9][0-9] |
Wildcard all 2 digit number |
Regular Expressions
NOTE |
Different than globbing (For file name), REGEX is for searching text pattern, best to use '', use with specific tools GREP,VIM,SED,AWK, |
grep 'b.t' |
Find pattern with b in first position, anything in second and t in third position |
grep 'b.*t' |
Pattern with b in the first, may or may not have 1 or many character and t in last postion |
grep 'bo*t' |
Pattern with b in first, may or may not have 'o' and t in last postion |
grep 'b.?t' |
No result, ? is part of extended REGEX, need to be used with EGREP |
\< |
Beginning of word |
\> |
End of word |
{n} |
Exactly n times |
|