Linux Commands Reference Sheet
1. General Purpose Commands
Command Purpose Example
PATH Environment variable echo $PATH
storing directories of
executables
man Displays manual pages for man ls
commands
echo Prints text/variables to echo 'Hello World'
terminal
printf Prints formatted output printf 'Name: %s\nAge:
%d\n' 'Gurmeet' 22
script Records terminal session to script [Link]
file
passwd Change user password passwd
uname Shows system/kernel info uname -a
who Shows logged-in users who
date Displays/sets date and time date '+%d-%m-%Y %H:
%M:%S'
stty Shows/sets terminal stty -a
settings
2. File Oriented Commands
Command Purpose Example
cat View/concatenate files cat [Link]
tail Show last lines of a file tail -n 20 [Link]
head Show first lines of a file head -n 15 [Link]
join Join two files by field join file1 file2
tee Output to file + screen ls | tee [Link]
pg View file page-wise pg [Link]
comm Compare two sorted files comm f1 f2
cmp Byte-by-byte comparison cmp f1 f2
diff Line differences in files diff f1 f2
tr Translate/replace tr a-z A-Z < [Link]
characters
more View file with scrolling more [Link]
wc Count lines/words/chars wc -l [Link]
lp Print file lp [Link]
od Display file in octal/hex od -x [Link]
ls List directory contents ls -la
cp Copy files cp file1 file2
mv Move or rename files mv [Link] [Link]
rm Remove files/directories rm -r folder
3. Directory Oriented Commands
Command Purpose Example
pwd Print working directory pwd
cd Change directory cd /home/user
mkdir Create new directory mkdir new_folder
rmdir Remove empty directory rmdir old_folder
ls List directory contents ls -l