Home Linux CentOS 17 linux Basic Commands with Examples

17 linux Basic Commands with Examples

In the previous tutorial, we have learned Installation of CentOS 7 with Screenshots . Now in this tutorial you will learn the 17 linux  basic commands with examples, which are very necessary for everyone.
Initially, I will explain you the commands which won’t affect the linux server.These commands are performed to check the information on server.

1. ifconfig –  To check the IP address of the system.

[arun@localhost ~]$ ifconfig
ifconfig command

2. pwd – To check the present working directory.

[arun@localhost ~]$ pwd
pwd command
pwd command

3. free – Memory utilization checked by this command.

[arun@localhost ~]$ free                //by default output in kilobytes
 [arun@localhost ~]$ free -m          //shows output in megabytes 
Check Memory utilization on linux
Check Memory utilization on linux

4. ls –  shows the files and directories of the present directory.

[arun@localhost ~]$ ls
ls output
ls output

5.  ll – This output shows the file permission, owner, group, size of the directory and the file.

[arun@localhost ~]$ ll
ll command output
ll command output

6. who – This command is used to check the currently logged user into the system.

[arun@localhost ~]$ who
who command
who command

7. df – Shows the used & available hard disk space.

[arun@localhost~]$  df 

To check hard disk space in gigabytes or megabytes use -h with df command.

[arun@localhost~]$  df  -h
df command output
df command output

8. top – This displays the currently running processes on the system.

[arun@localhost ~]$  top
top command result
top command result

9. cd – To change the current directory, use this before destination directory. Let us suppose want to change directory to Desktop then,
Syntax is:   cd  [destination path]

[arun@localhost ~]$  cd Desktop/ 
cd command
cd command 

10. cat – Very helpful command to view the content of the file.Here, want to see the content of file.text file then,
Syntax is:    cat [file name]

[arun@localhost ~]$  cat file.text 
cat command output

11. history – As the name suggests, to check the history. Yes, this will display the list of the commands executed by the present user since the session started.

[arun@localhost ~]$  history  
history command result
history command result

12. clear – It is used to clear the terminal screen. Two screenshots are uploaded before and after executing clear command.

[arun@localhost ~]$  clear
clear command
clear command
clear command output
After clear command output

Now I will share the commands which affect the system, please be careful with these commands.

13. touch – This command is to create new files.I want to create file with the name “myfile”, then command would be:

[arun@localhost ~]$  touch myfile
touch command output
touch command output

14. mkdir – Creates new directory using this command. For example, we are going to create directory with name “linux”, then :

[arun@localhost ~]$  mkdir linux
Create directory with mkdir command
Create directory with mkdir command

15. rmdir – Removes only empty directory. Now remove empty directory “linux”.

[arun@localhost ~]$  rmdir linux/
command rmdir
command rmdir

16. rm – To remove directory which contains data, use this command.Now lets assume directory “centos” which contains files and directory.

[arun@localhost ~]$  rmdir linux
rmdir command
rmdir command

17. mv – mv  is multi purpose command, can move and also used to rename 
files or directory.Here linux directory moving to /home/arun/Desktop/.
                              
Syntax is:   mv   [source file]  [destination path]

[arun@localhost ~]$  mv    linux/     /home/arun/Desktop/     
mv command to move files or directory
mv command to move files or directory

To rename files or directory, remain in same directory. For example here we are renaming linux directory to centos.

[arun@localhost ~]$ mv  linux/  centos
mv command used to rename file/directory
mv command used to rename file/directory

Congratulations !!! you have learned the 17 linux Basic Commands with Examples.

LEAVE A REPLY

Please enter your comment!
Please enter your name here