# Basic Linux Commands

#90 Days of DevOps Challenge - Day 3

## **What is the Linux command to :-**

* ### **To view what's written in a file :-**
    

`Command:- Cat <File_name>`

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1681712245633/b5219b96-140c-417e-b7ce-5786e58c4810.png align="center")

* ### To change the access permissions of files :-
    

`Command:- Chmod`

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1681712585085/bbccf675-ddab-4425-8c1d-08308b830751.png align="center")

before using this command we can type **<mark>ls -la</mark>** and we can identify what will be permission we need to require to run any files

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1681712304818/f53a8b77-bd0a-439c-b7a6-c7968726a870.png align="center")

So in the above example, we can see currently what's the file permission and if we need we can change the file permission based on the requirement

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1681712531147/50640f02-4265-44b8-b244-34cb38f5ebfa.png align="center")

* ### **To check which commands you have run till now :-**
    

`Command:-history`

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1681713161999/e28e2b5f-68bd-4b87-a8d7-004deb08075c.png align="center")

* ### **To remove a directory/ Folder :-**
    

`Command:-rm -rf <directory/folder_name>`

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1681713338806/9d84320c-b70a-43f4-a392-fcaea085924f.png align="center")

* ### **To create a fruits.txt file and view the content :-**
    

If we need to create any file then we can use `touch <file_name>`

If we need view any created file then we can use `cat <file_name>`

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1681713683254/181ec559-9b02-4c64-8be2-d7b0908125bb.png align="center")

* ### **Add content in devops.txt (One in each line) - Apple, Mango, Banana, Cherry, Kiwi, Orange, Guava.**
    

So in this query we create text file using vim and then we can press i and type all the name as per requirement

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1681714572547/8993bac0-4d48-4c5f-92a9-058bfdd5b638.png align="center")

* ### **To Show only the top three fruits from the file :**
    

`Command:-head -3 <file_name>`

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1681714272460/a25110f8-09f5-4597-af92-5d0756345c03.png align="center")

* ### **To Show only the bottom three fruits from the file :-**
    

`Command:-tail -3 <file_name>`

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1681714679715/09783d36-513a-4632-a8e5-6e7760048c9f.png align="center")

* ### ***To create another file Colors.txt and to view the content:-***
    

If we need to create any file then we can use `touch <file_name>`

If we need view any created file then we can use `cat <file_name>`

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1681714887770/fefd65a0-f8f0-4600-a894-f2d2760896d7.png align="center")

* ### **Add content in Colors.txt (One in each line) - Red, Pink, White, Black, Blue, Orange, Purple, Grey :-**
    

As i have mentioned in the above we will follow same steps

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1681715085916/a74985b9-42a3-4342-b5f0-cbee8682b575.png align="center")

* ### **To find the difference between fruits.txt and Colors.txt files:**
    

`Command:- diff <file_name> <file_name>`

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1681715199490/cad00ca2-53af-4db0-8366-879e1b7a889f.png align="center")

[**Devops**](https://shreyakhangan.hashnode.dev/tag/devops)[**#devops,#90daysofDevOps**](https://shreyakhangan.hashnode.dev/tag/devops90daysofdevops)

**Thank you for reading!! I hope you find this article helpful!!**

**if any query or if any correction to be done in this blog please let me know.**

**Happy Learning!!**

**Saikat Mukherjee**
