Day-3 of DevOps Challenge: Today's task is all about basic Linux commands with a twist.

ยท

2 min read

View the content of a file and display line numbers. ๐Ÿ“„๐Ÿ’ฌ

Change the access permissions of files to make them readable, writable, and executable by the owner only. ๐Ÿ”’๐Ÿ‘จโ€๐Ÿ’ป

Remove a directory and all its contents ๐Ÿ—‘๏ธ

Create a fruits.txt file ๐Ÿ“„, add one fruit per line ๐ŸŽ๐ŸŒ๐Ÿ’, and then display the content ๐Ÿ“‹.

Add content to devops.txt (one item on each line) ๐ŸŽ Apple, ๐Ÿฅญ Mango, ๐ŸŒ Banana, ๐Ÿ’ Cherry, ๐Ÿฅ Kiwi, ๐ŸŠ Orange, ๐Ÿˆ Guava. Then, add "๐Ÿ Pineapple" to the end of the file.

Show the first three fruits from the file in reverse order.

tac: Reverses the order of the lines from the output of the head command.

tail -n 3 devops.txt: Displays the last three lines of the devops.txt file.

sort: Sorts the lines alphabetically.

Create another file Colors.txt, add content (one color per line), and display the content.

Add content in Colors1.txt (one in each line) - Red, Pink, White, Black. Then, prepend "Yellow" to the beginning of the file.

-i flag tells sed to edit the file in place.

1iYellow inserts "Yellow" at line 1 (the beginning) of Colors.txt.

  1. Find and display the lines that are common between fruits.txt and Colors.txt.

    First, ensure both fruits.txt and Colors.txt are sorted. This is necessary because comm expects sorted input.

    -12 option suppresses lines unique to the first (-1) and second (-2) file, showing only the lines that are common (-12).

  2. Count the number of lines, words, and characters in both fruits.txt and Colors.txt.

Df (disk free) command will have an account of available disk space, used by file system.

Du (disk usage) command reports the size of directory tree including all the content.

Useradd Command create user

Grep Command how to searches for a particular string/ word in a text file.

Ping โ€“ This command will ping a host and check if it is responding.

ย