Basic Linux Commands for File Management

A Foodie Software Engineer's Journey to Eating Healthy and Learning Something New Every Day
Day 3 Task:
To view what's written in a file.
cat filenamevim filenamenano filename
To change the access permissions of files.
chmod 777 filename

To check which commands you have run till now.
history
To remove a directory/ Folder.
rm -rf filename
rmdir filename
To create a fruits.txt file and to view the content.
touch fruit.txt- to create fruit.txt filevim fruits.txt- to view contentcat fruits.txt- to view content
Add content in fruit.txt (One in each line) - Apple, Mango, Banana, Cherry, Kiwi, Orange, Guava.
echo Apple > fruits.txtadd Apple word on the first lineecho Banana >> fruits.txtadd Banana word on the next lineecho Cherry >> fruits.txtadd Cherry word on the next lineor use a line command like below
echo -e "Apple \nBanana \nCherry \nKiwi \nOrange \nGuava \nMango \nWatermelon" >> fruits.txt
Show only the top three fruits from the file.
head -3 fruits.txt
Show only the bottom three fruits from the file.
tail -3 fruits.txt
Create another file Colors.txt and view the content.
touch Colors.txt- to create Colors.txt file
Add content in Colors.txt (One in each line) - Red, Pink, White, Black, Blue, Orange, Purple, and Grey.
echo Red > Colors.txtecho Pink >> Colors.txtecho White >> Colors.txtor use a line command like below
echo -e "Red \nPink \nWhite \nBlack \nBlue \nOrange \nPurple \nGray" >> Colors.txt
Find the difference between the fruits.txt and Colors.txt file.
diff Color.txt fruits.txtcompare files line by line