# Basic Linux Commands

* *To view what's written in a file*. - <mark>cat &lt;filename&gt;</mark>
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1680097359616/f6a93579-9926-4e6d-998a-4cf165c63159.png align="center")
    
* *To change the access permissions of files.* - <mark>chmod 777 &lt;filename&gt;</mark>
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1680097458097/64c0c21d-b346-4c62-87fe-3686064b4ec8.png align="center")
    
* *To check which commands you have run till now.* - <mark>history</mark>
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1680097491175/efab9eef-f949-4c10-993a-d95e64f1c536.png align="center")
    
* *To remove a directory/ Folder. -* <mark>rm -r &lt;directoryname&gt;</mark>
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1680097598962/bd0182bd-f425-4660-ae1d-f6e02be3d83d.png align="center")
    
* *To create a fruits.txt file and to view the content.* - <mark>touch fruits.txt , cat fruits.txt</mark>
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1680097653144/ffeef546-7a6f-4004-b650-3a83ef88347a.png align="center")
    
* *Add content in fruits.txt (One in each line) - Apple, Mango, Banana, Cherry, Kiwi, Orange, Guava. -* <mark>vi &lt;filename&gt; add the contents</mark>
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1680097747903/76ccfc20-2718-486b-a575-10b3afe28e58.png align="center")
    
* *To Show only top three fruits from the file. -* <mark>head -3 fruits.txt</mark>
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1680097788531/93827794-f5a0-4b6d-8265-e56961b5bea5.png align="center")
    
* *Show only the bottom three fruits from the file. -* <mark>tail -n 3 fruits.txt</mark>
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1680097822540/b90d9b42-bc0f-4af6-8231-3656e7b4a8b1.png align="center")
    
* *To create another file Colors.txt and to view the content. -* <mark>touch colors.txt. cat colors.txt</mark>
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1680097930525/812720c1-2ffb-454c-8c6a-73ff219ab9e7.png align="center")
    
* *Add content in Colors.txt (One in each line) - Red, Pink, White, Black, Blue, Orange, Purple, Grey. -* <mark>vi &lt;filename&gt; add the contents</mark>
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1680097959844/8bb078ca-85c1-4e44-ab98-e279bc6cf20c.png align="center")
    
* *To find the difference between the fruits.txt and Colors.txt files. -* <mark>diff fruits.txt colors.txt</mark>
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1680098001887/bf53e26d-e152-4c34-ae4f-075b89494928.png align="center")
    

Thank you for Reading.

Bikram Chatterjee
