# Linux Commands Cheat Sheet

# Introduction
As we are learning Devops, linux is very basic and important part of the Devops's journey as around 50
%-60% of devops depends on it.
Linux is an open-source operating system whose source code is available for modification and commercial and non-commercial distribution under the guidelines of the GNU General Public License.

- Linux is a freely available open-source OS.

- Linux maintians privacy of the user and lot more secure than windows OS.

- Linux is easy to install and network friendly.
## Linux Basic Commands
### File and Directory commands

- ls - Lists all the files and directories inside the current directory in which you are.

- ls -a - Lists all the files and directories in the current directory along with the hidden files.

- ls -l - Lists all the files and directories in the current directory with the details.

- ls -al - Lists files and directories of the current directory along with the details like permissions (read, write, execute), owner, file/dir size, etc.

- cd - This command is used to move to root directory.

- cd .. - This is used to move one level up directory.

- cd dirName - This command is used to move from one directory to particular directory. **Ex: cd Desktop**

- mkdir - This command creates a directory. **Ex: mkdir devops**

- rmdir - This command removes a directory. **Ex: rmdir devops**

- mv fileName “new file path” - This command moves file to specified path. **Ex: mv file1.txt Docs/**

- mv fileName newName - This command changes name of the file to newName. **Ex:mv file1.txt file2.txt**

- pwd - It prints present working directory.
### File permission commands
There are three types of people accessing files i.e., user, group and others.CHMOD method is used to give permission to files.
> 4 - read(r),
> 2 - write(w),
> 1 - execute(x) i.e., (4+2+1=7)
        chmod 777 - read,write and execute for all.
        chmod 755 - rwx for user, rx for group and others.

### Disk Usage Commands

- du pathofdirectory - To find out the disk usage summary.

- du -h pathofdirectory - This will bring up your information in human readable format

- du -sh nameofdirectory - This is to find out total disk usage
### System Information Commands

- who - It gives logged in name of user, date and time and remote hostname of user.

- whoami - It gives name of logged in user.

- hostname - Shows the name of the system host.

- whereis fileName - It gives possible locations of fileName.

- date - This command is used to show the current date and time.

- cal - Shows the calendar of the current month.

- clear - Clears the terminal i.e. no previous command will be visible on the screen now.
### Environment Variable Commands

- env - This command displays all the environment variables.

- echo $Variable - This command displays the environment variable.
### Root Commands

5 ways to become a sudo user in Linux OS 

- sudo -i

- sudo -s

- sudo su -

- su -root

- su -


I hope these commands help in learning basics of linux. I will keep on updating this commands as I learn in future.

Please like and comment and drop any suggestions if it is there in comment section.
































