Command Description Example
ls List files and directories ls ls /home ls –al ls –al /home/student
cd Change current directory cd /home
pwd Print current directory pwd
cp Copy files cp a.txt /home cp a.txt b.txt
mv Move or rename file mv a.txt /home mv a.txt b.txt
rmdir Remove empty directory rmdir test
rm Remove file or Non empty directory rm a.txt rm –r test
mkdir Create directory mkdir test
cat Print file content cat a.txt
Command Description Example
grep Search for text in file grep “word” a.txt
head Display the first 10 lines of a file head a.txt head –n 5 a.txt
tail Display the last 10 lines of a file tail a.txt tail –n 5 a.txt tail –f a.txt
less Display text from file in one screen less a.txt
ps Display list of running processes ps aux
lsof Display list of open files lsof –i
netstat Display network connections netstat –antp
ifconfig Display network information ifconfig
sort Sort content of a file sort a.txt
Command Description Example
uniq Remove duplicate lines (sort first) uniq a.txt
stat Display information about a file stat a.txt
ping Test network connectivity ping google.com
whoami Display current user whoami
passwd Change user passwd passwd student
kill Terminate process kill 1845
ln Create link file ln –s file link ln file link
find Search on files find / -name a.txt find / -name "*.txt"
nano Text editor nano filename (Save file : Ctrl+X )
Character Description Example
/ Directory separator cd /home/student
\ Escape character mkdir test\ dir
. Current directory ls . cat ./a.txt
.. Parent directory ls .. cat ../a.txt
~ User home directory cd ~
& Run in background gedit &
* Represent one or more characters ls *.txt
? Represent single character ls a?.txt
[] Represent range of values ls a[0-9].txt
Character Description Example
; Command separator (run anyway) pwd ; whoami ay7aga ; whoami
Command separator (run second
&& pwd ; whoami ay7aga ; whoami
command if the first succeed)
Command separator (run second
|| pwd ; whoami ay7aga ; whoami
command if the first failed)
Directory name Directory description
/ Root directory, every thing starts from there.
/root Root home directory, contains Desktop, Downloads, Documents and so on.
/bin Contains users binaries (ls, cp, cat).
/sbin Contains system binaries (reboot, ifconfig, fdisk).
/etc Contains system configuration files.
/home Home directory for all users (/home/student, /home/testuser).
/boot Contains boot load files and kernel files.
/lib Contains system libraries.
/var Contains variable data which is continuously change in size (log files: /var/log).
Contains user programs and it contains another bin (/usr/bin) & sbin (/usr/sbin)
/usr
(which contains second level user and system binaries).
/mnt Mount directory where system admin can mount any partitions here.
/tmp Temporary files (delete at reboot).