Linux Basic Commands3 min read

Prabhin Prabharkaran Administrator
DevOps Engineer

He is a Technical professional. He is a person who loves to share tricks and tips on the Internet. He Posts what he does!

follow me

You all knows that linux is a wonderful operating systems. Those who loves codes loves terminal also. If you are linux user these are the linux basic commands that you should know.

Here is the following commands which will be useful for you.

linux basic

Basic Commands


mkdir command used to create a directory

root@www:/home/techrunnr/test# mkdir testfolder


List the files and directories in the existing folder.

root@www:/home/techrunnr/test# ls
file file1 file2


shows the path to existing directory

root@www:/home/techrunnr/test# pwd


cd command enters into a directory.

root@www:/home/techrunnr/test# cd testfolder/
root@www:/home/techrunnr/test/testfolder# pwd

cd ..

cd .. Command moves you to the previous directory.

root@www:/home/techrunnr/test/testfolder# pwd
root@www:/home/techrunnr/test/testfolder# cd ..
root@www:/home/techrunnr/test# pwd


only cd moves current location to users home directory

techrunnr@www:/opt$ pwd
techrunnr@www:/opt$ cd
techrunnr@www:~$ pwd



Touch  command used to create a file with empty contents
root@www:/home/techrunnr/test# touch doc1 doc2
root@www:/home/techrunnr/test# ls
doc1 doc2 file file1 file2 testfolder



cat command to display contents inside the file.
root@www:/home/techrunnr/test# cat file1
this a test file.



To Copy contents of file1 to file2

root@www:/home/techrunnr/test# cp file1 file2
root@www:/home/techrunnr/test# cat file2
this a test file.

Copy a folder contents to other folder.

root@www:/home/techrunnr#cp -r test1/ test2/
where test1 and test2 are two folders

root@www:/home/techrunnr/test# ls test1
doc1 doc2
root@www:/home/techrunnr/test# cp -r test1/* test2/
root@www:/home/techrunnr/test# ls test2
doc1 doc2


mv  command used to move a file or folder to another. It can be used for renaming a file/folder also.
mv doc1 file

root@www:/home/techrunnr/test/test1# ls
doc1 doc2
root@www:/home/techrunnr/test/test1# mv doc1 file
root@www:/home/techrunnr/test/test1# ls
doc2 file


History commands list the list of previous commands you executed.
root@www:/home/techrunnr/test/test1# history

890 cp -r test1/* test2/
891 ls test2
892 ls
893 cd test1/
894 ls
895 mv doc1 file
896 ls


vi command is used to edit file. Simply we can say that its an text editor.
root@www:/home/techrunnr/test/test1# vi file

use letter i to insert contents into the file.

[Escape]:wq! to save the file.

[Escape]:q! to exit the file without saving


ps command used to see the process list which is running in the linux box.
root@www:/home/techrunnr/test/test1# ps
5530 pts/7 00:00:00 sudo
5531 pts/7 00:00:00 su
5532 pts/7 00:00:00 bash
6689 pts/7 00:00:00 ps


It will gives you system uptime information.
root@www:/home/techrunnr/test/test1# uptime
09:39:03 up 1 day, 10:28, 2 users, load average: 0.89, 1.08, 0.99


Grep command is used to search string.
root@www:/home/techrunnr/test/test1# cat doc2
This is test file.
how are u.
hope you are doing good.

root@www:/home/techrunnr/test/test1# cat doc2 |grep Hi


© 2018, Techrunnr. All rights reserved.

Questions Answered
Articles Written
Overall Points

Related posts

Leave a Reply