Day 3 : DevOps ❤️
Table of contents
Let's Discuss some more questions on Linux
To view what's written in a file.
cat file_name
To change the access permissions of files.
chmod permission_code file_name
permission_code :
Read: 4
Write: 2
Execute: 1
\=> Users:Groups: Others
For Ex: chmod 700 file.sh
The above command means that users have all the 3 permissions (i.e. read, write, execute) on the other hand groups, and others have no permissions.
To check which commands you have run till now
history
To remove a directory/ Folder
rm -r folder_name
-r = recursively (used if the folder is not empty)
To create a fruits.txt file and to view the content.
vim fruits.txt cat fruits.txt
Add content in devops.txt (One in each line) - Apple, Mango, Banana, Cherry, Kiwi, Orange, Guava
echo "Apple" > devops.txt echo "Mango" >> devops.txt echo "Banana" >> devops.txt echo "Cherry" >> devops.txt echo "Kiwi" >> devops.txt echo "Orange" >> devops.txt echo "Guava" >> devops.txt
To Show only the top three fruits from the file
head -n 3 devops.txt
To Show only the bottom three fruits from the file
tail -n 4 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, Grey.
echo "Red" > Colors.txt echo "Pink" >> Colors.txt echo "White" >> Colors.txt echo "Black" >> Colors.txt echo "Blue" >> Colors.txt echo "Orange" >> Colors.txt echo "Purple" >> Colors.txt echo "Grey" >> Colors.txt
To find the difference between the fruits.txt and Colors.txt file
diff fruits.txt Colors.txt