There are a lot of commands available in a Linux terminal and it would be madness to try to learn them all but thanks to graphical desktop environments, you won’t have to. Just out of curiosity, you can run a simple command like this and see how many executables are available in the /usr/bin and /usr/sbin directories. This won’t be the exact number of commands available in Linux, but it’s close:

{ ls -1 /usr/bin ; ls -1 /usr/sbin/ ; } | wc -l

There are, however, some commands you need to be familiar with, just in case something happens and you don’t have access to the graphical environment. Let’s see a few of them.

Getting you around

1. cd – Changing directories

cd directory-name
cd /path/of/directory
cd ..         //moves back a directory
cd              //takes you to home directory
mkdir dir-name     //creates a new directory
pwd         //shows the current directory

2. ls – Listing

ls       //simple list of the current directory
ls -a     //shows hidden files
ls -als     //shows hidden files and ownership

3. cp – Copying

cp file1 file2
cp -r dir1/ dir2/

4. mv – Moving / Rename

mv file1 file2
mv dir1/ dir2/

5. rm – Removing

rm -i filename          //removes filename with prompt
rm -rf filename or directory   //removes without prompting
rm -rf /usr/share/docs       //removes directory ‘docs’ from ‘/usr/share’
rm -rf *.mp3          //removes only the files with the .mp3 extension
rm -rf *tmp*          //removes only the files containing ‘tmp’ in their names

Searching for files and/or directories

6. find

The basic synthax for ‘find’ is:
find /path/to/dir -name "filename"

You can also search in /etc for directories named apache:
find /etc -type d -name "apache*"

Search the entire system for mp3 files:
find / -name "*.mp3"

Find all files modified less than one day (~ searches in home directory):
find ~ -mtime -1

7. locate

You must first update the database:
sudo updatedb
locate file-name

System information

8. Running processes:

ps axfu

Terminating a process:

ps axfu | grep kwrite
rev 6727 3.4 0.9 2605976 39164 pts/2 Sl 23:26 0:00 \_ kwrite
kill -9 6727

9. RAM usage:

free -m

10. Hard disk info:

df -hT

11. CPU info:

cat /proc/cpuinfo

12. Kernel and distro info:

cat /proc/version

13. PCI buses info:

lspci -v

14. USB buses info:

lsusb -v

15. Network info:

ifconfig -a

16. Sort processes by memory usage (press q to quit)


17. List all packages installed on the system:

RedHat (Fedora):

rpm -qa

See if a particular package is installed:

rpm -qa | grep firefox

Debian (Ubuntu)

dpkg -l
dpkg -l | grep firefox
dpkg -s firefox

Working with compressed files:

18. zip

Add a file to a zip archive:

zip filename

Add a directory to a zip archive:

zip -r dir/

Uncompressing zip archive:


19. tar.gz

Compressing a file or directory to a tar.gz archive:

tar cvzf archive.tar.gz dir/

Uncompressing a tar.gz archive:

tar xfz archive.tar.gz

20. tar.bz2

Compressing a file or directory to a tar.bz2 archive:

tar -jcvf archive.tar.bz2 dir/

Uncompressing a tar.bz2 archive:

tar -jxvf archive.tar.bz2

Other commands

21. Working with logs and text files:

Show contents of a log file:

cat /var/log/syslog

Show only last lines:

tail /var/log/syslog

Output is updated in real-time:

tail -f /var/log/syslog

22. More info on commands:

Help file:

man cp

Location of executable:

type cp

23. Text editor:

nano -w file.txt

24. Login to a remote Linux system through ssh:

ssh -v username@ip.address

25. Download a file from the web:


Funny and useless commands:

sudo apt-get install sl (for Ubuntu)
sudo yum install sl (for Fedora)

sudo apt-get install fortune (for Ubuntu)
sudo yum install fortune-mod (for Fedora)

sudo apt-get install cowsay (for Ubuntu)
sudo yum install cowsay (for Fedora)
fortune | cowsay

sudo apt-get install cmatrix (for Ubuntu only)

And so on!

25 usual Linux commands for the black terminal
Tagged on: