Essential Linux Commands
πTo view what's written in a fileπ
The 'cat' command is commonly used to display the contents of a file.
cat filename
πTo change the access permissions of files π
The 'chmod' command to change the access permissions of a file.
chmod [permissions] filename
πTo check which commands you have run till now.
history
ποΈTo remove a directory/folderποΈ
rm -r directory name
π To create a fruits.txt file and to view the contentποΈ
touch fruits.txt
cat fruits.txt
πAdd content in devops.txt (One in each line) - Apple, Mango, Banana, Cherry, Kiwi, Orange, Guava
echo -e "Apple\nMango\nBanana\nCherry\nKiwi\nOrange\nGuava" > devops.txt
π Show only the top three fruits from the fileπ
head 3 devops.txt
πShow only the bottom three fruits from the fileπ
tail 3 devops.txt
π¨To create another file Colors.txt and to view the contentπ
touch Colors.txt
cat Colors.txt
πAdd content in Colors.txt (One in each line) - Red, Pink, White, Black, Blue, Orange, Purple and Greyπ¨
echo "Red\nPink\nWhite\nBlack\nBlue\nOrange\nPurple\nGrey" > Colors.txt
πTo find the difference between fruits.txt and Colors.txt file
diff fruits.txt Colors.txt