Mastering Basic Linux Commands 🐧

Mastering Basic Linux Commands 🐧

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

Β