๐Ÿš€ Day 3: #90DaysOfDevOps Challenge

๐Ÿš€ Day 3: #90DaysOfDevOps Challenge

ยท

3 min read

Hello Everyone!

Hello Everyone!
Today marks Day 3 of my #90DaysOfDevOps Challenge, and Iโ€™m thrilled to share my journey so far! ๐ŸŽ‰

As part of today's tasks, I explored several fundamental Linux commands that are essential for anyone stepping into DevOps. Here's a summary of what I worked on and learned:

Tasks and Learnings:

Task 1: View the content of a file and display line numbers.

\=> Command: cat
The cat command allows you to view the content of a file. To include line numbers, you can use the cat -n option.

Task 2: Change the access permissions of files to make them readable, writable, and executable by the owner only.

\=> Command: chmod
The chmod command modifies file permissions. For example, chmod 700 file.txt grants all permissions (read, write, execute) to the owner while removing permissions for others.

๐Ÿ’ก Use ls -l to check file permissions and ownership.

Task 3: Check the last 10 commands you have run (history).

\=> Command: history | tail -10
The history command displays the command history, and combining it with tail -10 shows the last 10 commands.

Task 4: Remove a directory and all its contents.

\=> Command: rm -r
The rm -r (recursive) command removes directories along with their contents. Be cautious when using this command!

Task 5: Create a fruits.txt file, add content (one fruit per line), and display the content.

\=> Commands:

  • Use vim fruits.txt to create the file and add content.

  • Press i in Vim to insert content, and save the file with ESC + :wq.

Alternatively, use echo or touch commands to create files quickly.

Task 6: Add content in devops.txt (one in each line) - Apple, Mango, Banana, Cherry, Kiwi, Orange, Guava. Then, append "Pineapple" to the end of the file.

\=> Command: echo "Pineapple" >> fruits.txt
The >> operator appends content to a file without overwriting existing data.

Task 7: Show the first three fruits from the file in reverse order.

\=> Commands:

  • Use head -3 fruits.txt to get the first three lines.

  • Pipe it with tac to reverse the order: head -3 fruits.txt | tac.

Task 8: Show the bottom three fruits from the file, and then sort them alphabetically.

\=> Commands:

  • Use tail -3 fruits.txt to get the last three lines.

  • Pipe it with sort for alphabetical sorting: tail -3 fruits.txt | sort.orted we have piped it with sort command. sort command is used to sort the file in alpabatical order.

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

\=> Command: Use vim colors.txt or other file-creation methods (e.g., touch + echo).

Task 10: Add content in Colors.txt (one in each line) - Red, Pink, White, Black, Blue, Orange, Purple, Grey. Then, prepend "Yellow" to the beginning of the file.

\=> Command:
Use echo "Yellow" | cat - colors.txt > temp && mv temp colors.txt to add "Yellow" to the start of the file.

Task 11: Find and display the lines that are common between fruits.txt and Colors.txt.

\=>Command: comm -12 <(sort fruits.txt) <(sort colors.txt)
This command finds common lines between two files by suppressing unique columns from both files using comm.

Task 12: Count the number of lines, words, and characters in both fruits.txt and Colors.txt

\=> Command: wc fruits.txt colors.txt
The wc (word count) command outputs the number of lines, words, and characters for each file.

#90DaysOfDevOps #LinuxCommands #DevOpsChallenge #LearnDevOps #DevOpsJourney #Automation #LinuxBasics #DevOpsTools #CommandLine #ContinuousLearning

ย