# #Day 3 Basic Linux commands

*Display the text inside the file - cat command*

`syntax: cat filename.txt`

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679401145029/174d74b5-c077-4121-a092-f237ed34131f.png align="center")

*Check which commands the user has run till now -*

`syntax: history`

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679401104543/ab040d85-c5a2-4b9c-a6d7-456d29b6e71d.png align="center")

*Remove a directory(rm -r) -*

To remove an empty directory rm -r, where -r is for recursively

`syntax: rm -r dir_name`

for forcefully remove use -

`syntax: rm -rf dir_name`

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679401528666/df4945d4-1406-4e2d-af12-36b18b97ee6d.png align="center")

*create filename fruits.txt and add some fruits name*

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679402276214/a09f4ede-bd5f-4bc2-a7e9-fbb28508c864.png align="center")

*Tail command - used to show the last 10 lines of a file*

`Syntax: tail file_name`

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679402350592/c40f6fd9-c49d-43f2-98aa-ad1cf3e4b727.png align="center")

where -3 is for the last three lines

*Head command - used to display the first 10 lines of a files*

`Syntax: head file_name`

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679402457768/1dc57a4d-56c1-4fcf-8baf-a4c0d7f7c7bc.png align="center")

*Diff command -used to show the difference between files*

`syntax: diff file1 file2`

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679402652355/56e75dab-d2ca-437c-a65c-9505661d854b.png align="center")

*Change access permission (chmod)*

used to change the permission of a file, we've different numerical values as follows -

| Operation | Value |
| --- | --- |
| Read | 4 |
| Write | 2 |
| Execute | 1 |

`syntax - chmod 444 file_name`

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1679608124160/6f3d6979-51b4-4749-9b31-a63dbb192f0c.png align="center")

---
