Linux commands for DevOps (Practice commands used in day-to-day activities)
Table of contents
- Task: What is the Linux command to-
- To view what's written in a file.
- To change the access permissions of files - done by using "chmod" Command.
- 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.
- Show top three fruits from the file
- Show bottom three fruits from the file
- Create another colors.txt file and view its 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.
- Conclusion:
#DAY3 Of #90daysOfDevOps
Task: What is the Linux command to-
To view what's written in a file.
cat [filename]
To change the access permissions of files - done by using "chmod" Command.
In linux there are three permission of every file i.e. read(r), write(w), execute(x), also we can give permission to user in user group and other manner.
u : owner permission + : add permission
g : group permission - : remove permission
o : other user permission = : assign permission
Syntax to change access permission in file-
chmod <u,g,o><+,-,=><r,w,x> <filename>
To Check which commands you have run till now.
history
To remove a directory/ Folder.
To remove a directory with its contents, use rmdir -r
Command to delete forcefully all the data, rmdir -rf
rmdir option [foldername]
To create a fruits.txt file and to view the content.
touch fruits.txt
cat fruits.txt
Add content in devops.txt (One in each line) - Apple, Mango, Banana, Cherry, Kiwi, Orange, Guava.
Create the file using touch command.
touch [filename]
open vi editor and add (Apple, Mango, Banana, Cherry, Kiwi, Orange, Guava), one in each line.
NOTE: Press "i" to enter into insert mode.
now type ":wq" to save
Now give cat command to see the content of file:
Show top three fruits from the file
Show bottom three fruits from the file
Create another colors.txt file and view its content
touch colors.txt
cat colors.txt
Add content in Colors.txt (One in each line) - Red, Pink, White, Black, Blue, Orange, Purple, Grey.
open vi editor, press " i " to enter into "insert mode" and add Red, Pink, White, Black, Blue, Orange, Purple, Grey (One in each line), press " :wq " to save.
To find the difference between fruits.txt and Colors.txt file.
To compare the contents of two files, use the diff
command. ๐
diff fruits.txt Colors.txt
Conclusion:
๐ง๐ป Mastering Linux commands opens a world of possibilities. Practice, explore, and unleash the full potential of the command line for efficient and powerful control over your Linux system! ๐โจ๏ธโจ
Keep practicing, keep learning, and let the command-line prowess elevate your Linux experience to new heights!
Happy command-line adventures! ๐ง๐ปโจ