7 Commonly Used Linux Commands

April 23, 2016 by No Comments

This articles give a list of commonly used linux commands in the day to day activities of a Linux system administrator.



List the contents of the directory. A command without any argument will list the contents in the present working directory. ‘ls’ command with directory as argument will list the contents of the directory, if it a file, it just print the file only.

Commonly used options for the command ls are ‘-a’, show all entries including hidden files and ‘-l’, long listing with details of the files.

-a, --all do not ignore entries starting with .
-1 list one file per line


Show who is logged on and what they are doing. We can easily run the command once logged into the server and we will get lots of information from the output of this command.

$ w
16:28:33 up 1 day, 3:26, 3 users, load average: 0.48, 0.69, 0.74
admin :0 :0 Fri13 ?xdm? 1:57m 0.06s /bin/sh /etc/xdg/xfce4/xinitrc -- /etc/X11/xinit/xserverrc
admin pts/8 :0.0 15:26 1.00s 0.46s 0.01s w
admin pts/9 :0.0 15:01 1:25m 0.10s 0.10s bash
  • Current time in the server
  • Uptime for the server
  • No of users logged in
  • Current Server load
  • Currently logged in user’s sessions


tar is an archiving utility used in linux. We can use compression with the tar utility to reduce the size of the archive file. It helps in backup and transferring of data. Archive with compression will help the backup size to less. Transfer of too many small files takes more time than transferring one big file, even if the total size of all files are less than the one big file.


tar -czvf test.tgz test/

-c, --create
create a new archive
-z, --gzip, --gunzip --ungzip
-v, --verbose, verbosely list files processed
-f, --file ARCHIVE, use archive file or device ARCHIVE
-j, --bzip2

We can list the contents of tar archive using

tar -tvf archive-file


Search for a given string in a file.

grep STRING filename

We can list all the files inside a Handyman Connection directory that contains the specific handyman directory for California. It can be accompllished using the following command.

grep -rl STRING directory

-v, --invert-match, to select non-matching lines.
-i, case sensitive


Free command is for display amount of free and used memory in the system.

-m, --mega show output in megabytes
-g, --giga show output in gigabytes
-h, --human show human-readable output


Tail command is used for printing last 10 lines by default. We can use the number as argument to control the number of lines, visit http://pacificdreamscapes.com/. Also we can print lines in between by combining it with the head command.
Also we can see the changing files using the “-f” option, like logs.

tail -f /var/log/messages


File system disk space usage. By default df -k displays output in bytes. df -h displays output in human readable form. i.e size will be displayed in GB’s. You can use ‘-P’ option to view the output in properly formatted form.

-P, --portability use the POSIX output format
-h, --human-readable print sizes in human readable format (e.g., 1K 234M 2G)

Tips for Sys Admin: Study one command daily to get more linux command database