Day3- Devops Journey.

Some more Linux Command:

Task1: To view what's written in a file

#cat file name. ex- cat file1

Task2: To check and change the access permissions of files:

  • To check the permission configuration of a file

    #ls -l file1

    -> Here first dash(-) shows the type of file

    -> "rw-rw-r--" show permission for the file in which the first rw- tells about the user permission. Second rw- tells about the group permission and third r-- tells about the permission of others.

    -> 1 tells about how many links of this file.

    -> First "ubuntu" shows the owner of the file and the second "ubuntu" shows who is owing the group.

    -> Date and time show the last modification time of the file.

    -> In the last it shows the file name.

  • To change the access permissions of files:

    #chmod 777 file1

    or #chmod u=rwx,g=rw,o=r file1

    -> Three types of permission r(read),w(write), and x(execute). we can use their numerical value for their permission. Value of r=4, w=2, x=1, and for the no permission value is 0.

    -> By summing their value we can simply use one number.

For read, write, and execute value is 7.

For read and write value is 6.

For read and execute value is 5.

For read-only value is 4.

For write and execute value is 3.

For write-only value is 2.

For execute-only value is 1.

Task3: Add content in devops.txt (One in each line) - Contents. Also, assign the number to the entry.

Task4: To Show only the top three content from the file:

#head -3 devops.txt

Task5: To Show only bottom three contents from the file:

#tail -3 devops.txt

Task6: To check which commands you have run till now

#history

Task7: 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, and Grey.

#echo -e "Red\nPink\nWhite\nBlack\nBlue\nOrange\nPurple\nGrey" >> colors.txt

-> By using the echo command we create the file and add the content in the file.

-> -e will enable the newline character(\n).

-> \n will create a new line while using the append mode(\>>) it will create the file if it doesn't exist and if it exists new content will appended to the end of the file without overwriting the existing content.

Task8: To find the difference between devops.txt and Colors.txt file

#diff devops.txt colors.txt

Thank you for reading the blog:)