Hello Everyone,
Today we will perform the tasks of Day3 of DevOPs 90 days challenge.
We will check out some basic Linux commands and their uses and operations.
Have a look to some hands of basic and daily used commands.
1. To view what's written in a file.
We use the cat command in Linux to view the file.
cat<filename>
2. To change the access permissions of files.
We need to use chmod to change the permission of the file and chown is to change the ownership of the file. Following “chmod” command will give the user permission to read, write and execute a file
By default file permission is 644.
3. To check which commands you have run till now.
history command is used to check whatever commands we have ran till now.
4. To remove a directory/ Folder.
rm -rf command is used to delete a directory/folder in Linux including sub directories.
- The
rmdir
command removes empty directories.
5. To create a fruits.txt file and to view the content and add content in devops.txt (One in each line)- Apple, Mango, Banana, Cherry, Kiwi, Orange, Guava.
touch command is used to create a file.
cat command, cat <file_name>, is used to see the contents of the file
7. To Show only top three and bottom three fruits from the file.
head command is used to see the content of file from top
head -<number of lines to see> <file name>
tail command is used to see the content of file from bottom
tail -<number of lines> <file name>
8. To create another file Colors.txt and to view the content and Add content in Colors.txt (One in each line) - Red, Pink, White, Black, Blue, Orange, Purple, Grey.
9. To find the difference between fruits.txt and Colors.txt file.
diff command is used to show the difference in 2 files
diff <filename1> <filename2>
1,5c1,5 : This represents that lines 1 to 5 in the fruits.txt differ from lines 1 to 5 in the colors.txt.
< Apple : This line indicates that "Apple" is present in the first file (fruits.txt) but not in the second file (colors.txt) and similarly for others like < mango, <Banana, <Cherry <Kiwi.
--- :
This line separates the changes in the first set of lines from the changes in the second set.
\> Red : This line indicates that Red is present in the second file (colors.txt) but not in the first file(fruits.txt) and similarly for others like > Pink , > White, > Black, > Blue
7c7,8 : This represents shows that line 7 in both files is different.
<Guava : "Guava" is present in the first file but not in the second.
---
: This line separates the changes in the first set of lines from the changes in the second set.
\>Purple : "Purple" is present in the second file but not in the first.
\> Grey : "Grey" is also present in the second file but not in the first.
Here we have completed with Day03.
#Trainwithshubham #90daysofDevOps #devopsphodnahai