Day 3: Linux Commands
In the last part, We saw the importance of linux commands in devops practice. Today I have solved this assignment to have an better hands-on of linux commands.
Complete the following assignment.
1. To view what’s written in a file.
Ans = Cat file1.txt
2. To change the access permissions of files.
Ans = CHMOD 777
3. To check which commands you have run till now.
Ans = history
4. To remove a directory/ Folder.
Ans = rm newfolder, rm -rf newfolder (force remove)
5. To create a fruits.txt file and to view the content.
Ans = vim fruits.txt, cat fruits.txt
6. Add content in devops.txt (One in each line) — Apple, Mango, Banana, Cherry, Kiwi, Orange, Guava.
Ans = vim devops.txt
7. To Show only top three fruits from the file.
Ans = head -n 3 devops.txt
8. To Show only bottom three fruits from the file.
Ans = tail -n 3 devops.txt
9. To create another file Colors.txt and to view the content.
Ans = vim colors.txt, cat colors.txt
10. Add content in Colors.txt (One in each line) — Red, Pink, White, Black, Blue, Orange, Purple, Grey.
Ans = vim colors.txt
11. To find the difference between fruits.txt and Colors.txt file.
Ans = diff fruits.txt colors.txt