Ten Most Used Linux Commands

Posted by expertslogin on March 29th, 2013

In this article I am going to show you the most 10 used commands in Linux

Print Working Directory (pwd)

This command is used to print your current directory, it should print the output as the below example:

/home/bob

Change Directory (cd)

This command is used to change your current directory, this command will accept both absolute and relative paths as below example (consider you are in your home directory):

cd /home/bob/Desktop

Or

cd Desktop

Move (mv)

This command is used to move a file to a different location or rename it as the below example:

Moving:

mv /home/bob/test /home/bob/Desktop/test

Renaming:

mv /home/bob/test /home/bob/test2

List (ls)

ls Linux command is used to list the folders and file inside a directory, most people use this command with the -a & -l options, -a will display hidden files and -l for long listing format, the below output is for the ls -al command:

drwx------ 4 501 502 4096 Mar 21 10:39 .
drwxr-xr-x. 5 root root 4096 Oct 1 11:10 ..
-rw-r--r-- 1 501 502 18 Dec 2 2011 .bash_logout
-rw-r--r-- 1 501 502 176 Dec 2 2011 .bash_profile
-rw-r--r-- 1 501 502 124 Dec 2 2011 .bashrc
-rw-r--r-- 1 501 502 500 Jan 23 2007 .emacs
-rw-r--r-- 1 root root 0 Mar 21 10:39 file
drwxr-xr-x 2 501 502 4096 Nov 12 2010 .gnome2
drwxr-xr-x 4 501 502 4096 Jan 24 2012 .mozilla

Make Directory (mkdir)

This command is used to create a directory as the below example:

mkdir /home/bob/newfolder

Remove directory (rm)

This command is used to remove files and directories, to remove directories that contains files or folder you need to a add -r &-f options, the -r for recursive and -f for force as below:

rm -rf /home/bob/folder

Super user do (sudo) & Switch user (su)

The sudo command is used to run commands as the root user and the su command is used to change user as the below commands:

sudo service httpd restart //restart the service as root
su bob //switch the current user to bob

apt-get & yum

apt-get and yum commands are used to install or update packages, apt-get is used in Debian based distributions like Ubuntu and Mint, yum is used in the Redhat based distributions like Fedora and CentOS, they are used as the below example:

apt-get install Package-Name
yum install Package-Name

World Wide Web and get (wget)

This command is used to download files from http or ftp servers, you can resume a downloading file using -c option as the below example:

wget http://path-to-the-file //download a file
wget -c http://path-to-the-file //resume a download file

top

The top command provides a real-time view of the running system or server, the below is sample of the output of this command:

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
3192 root 20 0 68180 10m 4348 S 12.0 0.5 6278:55 krfb
2925 root 20 0 171m 10m 4548 S 2.0 0.5 1371:42 knotify4
3105 root 20 0 196m 11m 4944 S 2.0 0.6 1375:47 knotify4
18622 root 20 0 2676 1208 876 R 0.3 0.1 0:00.06 top
1 root 20 0 2912 1244 1012 S 0.0 0.1 0:00.87 init
2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd

About the author:

This Article is written by Bobbin Zachariah, who is also associated with ExpertsLogIn. He is a passionate lover of Linux and other open source tools. He had started his career in IT and Linux in early 2000. Love travelling, Technology writer, Blogging, Music and Enjoy the company with friends and family.

Like it? Share it!


expertslogin

About the Author

expertslogin
Joined: March 29th, 2013
Articles Posted: 4

More by this author