DevOps Day-3 Task: Basic Linux Commands
The challenge is for the DevOps Community to get stronger in DevOps

I am a highly skilled QA and testing manager with over 19 years of experience in the industry. I am passionate about ensuring the delivery of high-quality software and have a proven track record of successful project delivery. Additionally, I have extensive experience as a DevOps engineer, which has given me a deep understanding of the software development lifecycle and the importance of collaboration between teams. I am committed to staying up-to-date with the latest technologies and methodologies in the industry and am always seeking new challenges to enhance my skills.
- To view what's written in a file: To view the content of a file, you can use the "cat" command. For example, to view the content of a file named "example.txt", you can type:
bashCopy codecat example.txt
- To change the access permissions of files: You can use the "chmod" command to change the access permissions of files. For example, to make a file named "example.txt" readable, writable, and executable by the owner, you can type:
bashCopy codechmod u+rwx example.txt
- To check which commands you have run till now: You can use the "history" command to see a list of the commands you have run in the current terminal session. For example, to see a list of the last 10 commands you have run, you can type:
bashCopy codehistory 10
- To remove a directory/ Folder: You can use the "rmdir" command to remove a directory (folder). For example, to remove a directory named "example_dir", you can type:
bashCopy codermdir example_dir
Note: The "rmdir" command only works for empty directories. If the directory contains any files or subdirectories, you need to use the "rm" command with the "-r" (recursive) option.
- To create a fruits.txt file and to view the content: You can use the "touch" command to create a new file. For example, to create a file named "fruits.txt", you can type:
bashCopy codetouch fruits.txt
To add content to the file, you can use the "echo" command. For example, to add the word "apple" to the file, you can type:
bashCopy codeecho "apple" >> fruits.txt
To view the content of the file, you can use the "cat" command (as shown in step 1).
- Add content in devops.txt (One in each line) - Apple, Mango, Banana, Cherry, Kiwi, Orange, Guava: You can use the "echo" command to add content to a file. For example, to add the words "Apple", "Mango", "Banana", "Cherry", "Kiwi", "Orange", and "Guava" to a file named "devops.txt" (one word per line), you can type:
swiftCopy codeecho -e "Apple\nMango\nBanana\nCherry\nKiwi\nOrange\nGuava" >> devops.txt
Note: The "-e" option enables interpretation of backslash escapes (such as "\n" for a new line).
- To show only top three fruits from the file: You can use the "head" command to show the top lines of a file. For example, to show the top three lines of a file named "fruits.txt", you can type:
bashCopy codehead -n 3 fruits.txt
Note: The "-n" option specifies the number of lines to show.
- To show only bottom three fruits from the file: You can use the "tail" command to show the bottom lines of a file. For example, to show the bottom three lines of a file named "fruits.txt", you can type:
bashCopy codetail -n 3 fruits.txt
Note: The "-n" option specifies the number of lines to show.
- To create another file Colors.txt and to view the content: You can use the "touch" command to create a new file (as shown in step 5). For example, to create a file named "Colors.txt", you can type:
bashCopy codetouch Colors.txt
DevOps Day-2:https://hashnode.com/post/clff37bol000009l66p4o4ns7
DevOps Day-2:https://hashnode.com/post/clff23lx3000309mh12ef48dp
DevOps Day-1: https://hashnode.com/post/clff1free000409l5di5l5jov
