
To view what's written in a file.
cat filenameTo change the access permissions of files.
chmod [permissions] [filename]
4: Read (r) 2: Write (w) 1: Execute (x)To check which commands you have run till now.
historyTo remove a directory/ Folder.
rm [filename]rmdir [dirname]rm -r [dirname]To create a fruits.txt file and to view the content.
touch fruits.txtcat fruits.txtAdd content in devops.txt (One in each line) - Apple, Mango, Banana, Cherry, Kiwi, Orange, Guava.
vim devops.txtan editor will open and write
AppleMangoBananaCherryKiwiOrangeGuavaesc
:wq!: used to enter cmds
w for saving
q to quit
! used for frocefully
To Show only top three fruits from the file.
head -n 3 fruits.txtTo Show only bottom three fruits from the file.
tail -n 3 fruits.txtTo create another file Colors.txt and to view the content.
touch Colors.txtcat Colors.txtAdd content in Colors.txt (One in each line) - Red, Pink, White, Black, Blue, Orange, Purple, Grey.
follow the steps mention in step 6 and add below it.
To find the difference between fruits.txt and Colors.txt file.
diff [file1] [file2]