# Linux Basics

### Hi Folks!

We'll cover Linux roadmap from Scratch to advance. in two part. It will help you to enhance your knowledge. In this we will learn about Basic Linux

#90daysofdevops

#### What is Linux - Linux is a Operating System similar to windows it also manages the resource of a computer and provides a plateform to the softwareapplications to run .

Below is the linux architecture :

![Introduction to Linux Operating System - GeeksforGeeks](https://media.geeksforgeeks.org/wp-content/uploads/20200105215737/Untitled-Diagram-215-1.jpg align="left")

#### <mark>Kernel</mark>\- in simple language Kernel works as a heart of linux which connects and hardware and application .

#### <mark>Shell </mark> \- Its a kind of doorway which provide interaction between user and kernel,It takes commands from the user and executes the kernel’s functions.

## Here, Below I will be explaining on my words what each commands does.

#### <mark>⏩ls</mark>\- Lists all the files in present directory

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679929781583/0ea3d211-1d4b-44f0-9217-1f287a781437.png align="center")

#### <mark>⏩clear </mark> \- It clears your screen and make it blank.

#### <mark>⏩pwd </mark> \= t will tell you present directory in which you are present right now .

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679929891692/39f9dafb-5dad-4683-b300-5e3868fd4a1f.png align="center")

#### <mark>⏩cd ..</mark> = it will go to one directory back .

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679930003488/ea68171f-62c9-4525-a55b-6f80cf368358.png align="center")

Above we were in /home/aniketsingh and after executing cd .. it went to one dir back that is /home.

#### <mark>⏩cd -</mark> = It will send you to last present directory

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679930257462/cd01e056-c3e4-4d7d-9d59-c9a8cb4fd97a.png align="center")

#### <mark>⏩mkdir </mark> \- it will create a new directory

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679930365663/a3444e24-df98-48a2-9811-a8eee5d99d8f.png align="center")

Here a new directory(folder ) is created with name blog

#### <mark>mkdir -p</mark> - it will create nested directory

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679933941976/24af8484-daaf-46aa-b772-8ed158a08d34.png align="center")

In above pic , nested directory(dir under dir.) is created.

#### <mark>mkdir {1..10}</mark>\- It will create 10 directory at a time from number 1 to 10

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679934074016/50596bf0-2fab-43e7-9f0f-6324188f33ad.png align="center")

#### <mark>⏩rmdir</mark>\- it will remove empty directory

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679930605634/eab8f84b-2bf5-4598-a632-1b390a4b2175.png align="center")

Above I created a file inside blog directory due to which rmdir is not able to delete the file.

#### <mark>⏩rm</mark> - It will delete the directory or file

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679930723538/99041dc9-9ef7-47e1-a892-6e6e5b1af258.png align="center")

In rmdir it was not deleted but using rm -r(recursive) the blog folder got deleted instead of having file inside it .

## Below are the options we used with commands for specific task

<table><tbody><tr><td colspan="1" rowspan="1"><p>-a</p></td><td colspan="1" rowspan="1"><p>Show all (including hidden)</p></td></tr><tr><td colspan="1" rowspan="1"><p>-R</p></td><td colspan="1" rowspan="1"><p>Recursive list</p></td></tr><tr><td colspan="1" rowspan="1"><p>-r</p></td><td colspan="1" rowspan="1"><p>Reverse order</p></td></tr><tr><td colspan="1" rowspan="1"><p>-t</p></td><td colspan="1" rowspan="1"><p>Sort by last modified</p></td></tr><tr><td colspan="1" rowspan="1"><p>-S</p></td><td colspan="1" rowspan="1"><p>Sort by file size</p></td></tr><tr><td colspan="1" rowspan="1"><p>-l</p></td><td colspan="1" rowspan="1"><p>Long listing format</p></td></tr><tr><td colspan="1" rowspan="1"><p>-1</p></td><td colspan="1" rowspan="1"><p>One file per line</p></td></tr></tbody></table>

#### <mark>⏩touch </mark> \- It will make a empty file

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679931289598/d22def8c-b153-400e-b906-b1a7d2ae356b.png align="center")

here a new file with first.txt got created

#### <mark>⏩hostname</mark>\- it shows server name (Ip addreess) which you are connected

#### <mark>⏩whoami</mark>\- It will show you your username by which you are active

#### <mark>⏩cal</mark>\- It will display calendar (If not working do ... Sudo apt install ncal )

#### <mark>⏩date</mark> - it shows date and time

#### <mark>⏩uname -</mark>It will display kernel Name

#### <mark>⏩jobs </mark> \- It shows running jobs

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679932574040/b0fd3616-1910-45d5-ac3d-bb5a84278fea.png align="center")

#### <mark>⏩ps </mark> \- it will show the process status with process ID

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679934193273/f0641768-c310-4933-8786-82b91685215f.png align="center")

#### <mark>⏩history</mark> - It shows the history of last executed commands

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679934308566/07ee1955-3acb-473d-927f-88328267ba5d.png align="center")

#### <mark>⏩cat </mark> \- It will display the content of a file

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679934438584/2564d29a-978b-4703-aaeb-18a5fbb1c149.png align="center")

#### <mark>⏩cp </mark> \- It copies file from one path to another , or in same path it will create one more with different name and same content.

#### **<mark>⏩mv </mark>** \- It moves the file or dir to different path or in same path by changing the name

#### **<mark>⏩</mark>**<mark>gzip</mark> - It will zip or compress the file

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679935002200/b6a493d0-51c0-4835-9d48-f18d7449f6ae.png align="center")

Here it zipped the file and add a extension .gz, for viewing the content of zippped file we need to use zcat .

#### **<mark>⏩</mark>**<mark>gunzip</mark>\- It will unzip the file

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679935195313/fca246ad-b325-46d6-8077-149a96a0133c.png align="center")

#### **<mark>⏩</mark>**<mark>man </mark> \- it will show you the manual of any command

<mark>syntax - man command name</mark>

#### **<mark>⏩</mark>**<mark>Kill </mark> \- It is used to kill any running process with the help of PID(process ID)
