Basic Linux Commands
To view what's written in a file :
cat filename
vim filename
nano filename
To change the access permisson of the file:
chmod premission <folder name>
To change which commands you have run till now :
history
To remove a directory / folder:
for a folder
rmdir
<foldername>
for a file
rm <filename>
To create a fruits.txt file and to view the content:
to create a fruits.txt file
touch fruits.txt
to view the content
cat
fruits.txt
Add content in devops.txt (One line each line) - Apple, Mango, Banana, Cherry, Kiwi, Orange, Guava:
echo -e "Apple\nMango\nBanana\nCherry\nKiwi\nOrange\nguava" > devops.txt
To show only top 3 fruits from file:
head -n
3 fruits.txt
To show only bottom 3 fruits from file
tail -n 3 fruits.txt
To create another file colors.txt and to view the content
to create a colors.txt file
touch colors.txt
to view the content
cat color.txt
Add content in colors.txt (One in each line) - Red, Pink, White, Black, Blue, Orange, Purple, Grey:
echo -e
"Red\nPink\nWhite\nBlack\nBlue\nOrange,\nPurple\nGrey" >colors.txt
To find the difference between fruits.txt and colors.txt:
diff fruits.txt colors.txt