Table of contents
- What is the Linux command to :-
- To view what's written in a file :-
- To change the access permissions of files :-
- To check which commands you have run till now :-
- To remove a directory/ Folder :-
- To create a fruits.txt file and view the content :-
- Add content in devops.txt (One in each line) - Apple, Mango, Banana, Cherry, Kiwi, Orange, Guava.
- To Show only the top three fruits from the file :
- To Show only the bottom three fruits from the file :-
- To create another file Colors.txt and to view the 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 files:
#90 Days of DevOps Challenge - Day 3
What is the Linux command to :-
To view what's written in a file :-
Command:- Cat <File_name>
To change the access permissions of files :-
Command:- Chmod
before using this command we can type ls -la and we can identify what will be permission we need to require to run any files
So in the above example, we can see currently what's the file permission and if we need we can change the file permission based on the requirement
To check which commands you have run till now :-
Command:-history
To remove a directory/ Folder :-
Command:-rm -rf <directory/folder_name>
To create a fruits.txt file and view the content :-
If we need to create any file then we can use touch <file_name>
If we need view any created file then we can use cat <file_name>
Add content in devops.txt (One in each line) - Apple, Mango, Banana, Cherry, Kiwi, Orange, Guava.
So in this query we create text file using vim and then we can press i and type all the name as per requirement
To Show only the top three fruits from the file :
Command:-head -3 <file_name>
To Show only the bottom three fruits from the file :-
Command:-tail -3 <file_name>
To create another file Colors.txt and to view the content:-
If we need to create any file then we can use touch <file_name>
If we need view any created file then we can use cat <file_name>
Add content in Colors.txt (One in each line) - Red, Pink, White, Black, Blue, Orange, Purple, Grey :-
As i have mentioned in the above we will follow same steps
To find the difference between fruits.txt and Colors.txt files:
Command:- diff <file_name> <file_name>
Thank you for reading!! I hope you find this article helpful!!
if any query or if any correction to be done in this blog please let me know.
Happy Learning!!
Saikat Mukherjee