Skip to main content

Command Palette

Search for a command to run...

Basic Linux Commands

Updated
1 min readView as Markdown
Basic Linux Commands
H
Project manager, DevOps Enthusiast, Cloud and Storage Engineer. LinkedIN: https://www.linkedin.com/in/hemant9singh

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

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

-> 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

-> 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

-> To check which commands you have run till now.

history

-> To remove a directory/folder.

rm filename

-> 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

-> To show only the top three fruits from the file.

head -3 fruits.txt

-> To show only the bottom three fruits from the file.

tail -3 fruits.txt

-> To find the difference between the 2 texts file.

diff <file 1> <file2>

More from this blog

Hemant's

23 posts

Devops Enthusiast/ Cloud/Storage Engineer CrossFit athlete