DEV Community

Cover image for Linux: The Commands to Know
DevManas13
DevManas13

Posted on

Linux: The Commands to Know

Linux is being used all over the place now, android, IOS, supercomputers, in servers and at many different places. But, as compared to windows, its working is little bit different.

If you are using windows, then you must be familier with the copying and pasting files or folders, or navigating from one folder to another. You can do the same in linux GUI, but the fun of using linux is actually is in using command line, for nearly in every kind of stuff.

In this article, I am going to tell about some beginner linux commands, to start with, which makes your life easy to use linux.

1. pwd

pwd command

pwd stands for Present Working Directory and its needed to check your location in the terminal. Consider if you want to create a file in Desktop directory(folder in windows), then you should check first that are u actually in Desktop directory or in some other one.

2. whoami

whoami command

whoami commands tells you, your login info. Consider if you are login as a root, then this command will return root instead of the name of the user (manas in my case).

3. cd

cd command

cd command let you navigate the directories of the linux filesystem. Consider you are at the root level and you want to go to Desktop, then your command will be cd Desktop, which will let you navigate to the Desktop directory and in the above image, we are confirming the directory, by using pwd command.

But, what if you want to go back one directory, or multiple.

going back with cd

In this case, you use cd .. to go one directory back, but if you want to go multiple directories back, then you can use as many .. after cd, as demonstrated in the above image.

4. ls

ls command

ls command lets you list all the files and directories of a specific directory (in this case its root).

But, if you want to check all the files with more information, like the permissions, creation time etc, then you should use the command ls -l as shown in the image below.

ls -l command

But, if you even want to list the hidden files of the directory, you can do that with the command ls -la.

5. touch

touch command

touch command helps you to create file, as I created newfile.txt in the above screenshot.

6. mkdir

make directory

mkdir stands for make directory, and as the name stands, this command is being used to create directories.

7. rm

rm command

rm command is being used to delete the file (not directory).

But, if you want to remove the empty directory, then you should use the command rmdir <name>

But, if the directory is not empty and still you want to delete the whole directory, with items inside it, then you should use the command, rm -r <name>.

rmdir command


I hope you love this article over beginners linux commands and I hope it will help you with your linux journey. I will be writing an article a day over linux and cybersecurity.

If this article is helpful for you, save the post and like it too, and give you recommendation and feedback over the comment section.

Top comments (0)