Day3:- Task: Basic Linux Commands

Day3:- Task: Basic Linux Commands

Table of contents

Task

  1. To view what's written in a file.

  2. To change the access permissions of files.

  3. To check which commands you have run till now.

  4. To remove a directory/ Folder.

  5. To create a fruits.txt file and to view the content.

  6. Add content in devops.txt (One in each line) - Apple, Mango, Banana, Cherry, Kiwi, Orange, Guava.

  7. To Show only top three fruits from the file.

  8. To Show only bottom three fruits from the file.

  9. To create another file Colors.txt and to view the content.

  10. Add content in Colors.txt (One in each line) - Red, Pink, White, Black, Blue, Orange, Purple, Grey.

  11. 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