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.
Firstly, I will explain to you the commands which won’t affect the Linux server. These commands are performed to check the information on the server.
Commands To Display Information on Terminal
1. ifconfig – To check the IP address of the Linux system.
[arun@localhost ~]$ ifconfig
2. pwd – To check the present working directory.
[arun@localhost ~]$ pwd
3. free – Memory utilization checked by this command.
[arun@localhost ~]$ free //by default output in kilobytes
[arun@localhost ~]$ free -m //shows output in megabytes
4. ls – shows the files and directories of the present directory.
[arun@localhost ~]$ ls
5. ll Command – This output shows the file permission, owner, group, size of the directory and the file.
[arun@localhost ~]$ ll
6. who – This command is used to check the currently logged user into the system.
[arun@localhost ~]$ who
7. df – Shows the used & available hard disk space.
To check hard disk space in gigabytes or megabytes use the -h option with df command.
[arun@localhost~]$ df -h
8. top – This displays the currently running processes on the system.
[arun@localhost ~]$ top
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/
10. cat – Very helpful command to view the content of the file. Here, want to see the content of the file.text file.
Syntax is: cat [file name]
[arun@localhost ~]$ cat file.text
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
12. clear – It is used to clear the terminal screen. Two screenshots are uploaded before and after executing the clear command.
[arun@localhost ~]$ clear
Now will share the commands which affect the system, please be careful with these commands.
Linux Commands which Affects System
13. touch – This command is to create new files. Here creating a file with the name “myfile”.
[arun@localhost ~]$ touch myfile
14. mkdir – Creates a new directory using this command. For example, we are going to create a directory with the name “linux”.
[arun@localhost ~]$ mkdir linux
15. rmdir – This commands only removes an empty directory. For example, remove empty directory “linux” from the system.
[arun@localhost ~]$ rmdir linux/
16. rm – To remove a directory which contains data, use this command. For example, directory “centos” which contains files and directory.
[arun@localhost ~]$ rmdir linux
17. mv – mv is the multi-purpose command, can move and also used to rename files or directory.Here
Syntax is: mv [source file] [destination path]
[arun@localhost ~]$ mv linux/ /home/arun/Desktop/
To rename files or directory, remain in the same directory. For example, here we are renaming linux directory to centos.
[arun@localhost ~]$ mv linux/ centos
Congratulations !!! you have learned the 17 Linux Basic Commands with Examples.