# Basic Linux Commands

Practice makes a man perfect, and so does practicing Linux every day

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679500063349/312616d3-57c3-4723-9650-595a181bcb1b.gif align="center")

We move further on our Linux journey. I will list a few basic Linux commands.

\-&gt; To view what's written in a file.

cat command will list out the file contents, once you execute cat with the filename you want to read.

`cat filename`

\-&gt; To change the access permissions of files/folders.

In the below example we are giving read, write and execute permission.

777 denotes: read, write and execute permission for users, groups and others.

`chmod 777 foldername`

Each permission has a numeric value assigned to it:

\- read (r): 4

\- write (w): 2

\- execute (x): 1

\-&gt; To check which commands you have run till now.

`history`

\-&gt; To remove a directory/folder.

`rm filename`

\-&gt; To create a fruits.txt file and to view the content.

Vim is a text editor, after running vim fruits.txt, press i to insert text in the file.

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

`vim fruits.txt`

`cat fruits.txt`

\-&gt; To show only the top three fruits from the file.

`head -3 fruits.txt`

\-&gt; To show only the bottom three fruits from the file.

`tail -3 fruits.txt`

\-&gt; To find the difference between the 2 texts file.

`diff <file 1> <file2>`

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679500119161/315aaefc-bceb-48e3-af20-408bc5c58882.gif align="center")
