Table of contents
Task
To view what's written in a file.
To change the access permissions of files.
To check which commands you have run till now.
To remove a directory/ Folder.
To create a fruits.txt file and to view the content.
Add content in devops.txt (One in each line) - Apple, Mango, Banana, Cherry, Kiwi, Orange, Guava.
To Show only top three fruits from the file.
To Show only bottom three fruits from the file.
To create another file Colors.txt and to view the content.
Add content in Colors.txt (One in each line) - Red, Pink, White, Black, Blue, Orange, Purple, Grey.
To find the difference between fruits.txt and Colors.txt file.
Solution
first create file by command then write anything inside file and command for looking the content inside file is "cat filename"
nano hello.txt
cat hello.txt
for changing the permission
chmod 777 hello.txt
for checking history
history
create a directory by command "mkdir hello.txt" than the command for removing that directory is:-
rm -rf hello
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
To see top 3 fruit
head -n 3 devops.txt
for seeing the last 3 fruit
tail -n 3 devops.txt
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 -e "Red\nPink\nWhite\nBlack\nBlue\nOrange\nPurple\nGrey" > Colors.txt
find the difference between fruits.txt and Colors.txt file.
diff fruits.txt Colors.txt
Conclusion
Finally, all the basic task were done of Day3
Github link:- https://github.com/sidharthhhh/90DaysOfDevOpss/blob/master/2023/day03/README.md