Linux: The Commands to Know
Tags: linux, beginners, tutorial, hacking
Published: 2022-08-25 08:04:00

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k7nnb9h4w5q61xo36so6.png)
 
`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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6uw1bs38mb0ew9edatd4.png)

`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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xs6scc5quz4pcqqdjyqq.png)

`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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ld78jql3hmayq36n196u.png)
 
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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ws4wpgkzri7pvsa3f04s.png)
 
`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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e6gw4os3whabqjjshrwz.png)

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oxxl9ik9d22dktydf4om.png)
 
`touch` command helps you to create file, as I created _newfile.txt_ in the above screenshot.

## 6. mkdir

![make directory](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y9lawwymoh0rok8voyg1.png)

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

## 7. rm

![rm command](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ounavi4bjy5rf0le07mn.png)
 
`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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mmd34aahcl4i9387pkbn.png)

 -----------------------------------------------------------
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.