Linux commands for DevOps

Linux commands for DevOps

Linux Commands used in Regular Day to Day Activities

Table of contents

No heading

No headings in the article.

  1. To view what's written in a file.

    cat :- cat command is used to view the contents of a file.

    syntax: cat <file_name>

  2. To change the access permissions of files.

    chmod:- Change the permission of a file or directory.

    syntax: chmod parameter <file_name/dir_name>

    Parameters: The mode which consists of 3 parts, owner, group, and others means what will be the permissions for these modes, and you must specify them.

    The permission is one of the followings:

    Read =4

    Write = 2

    Execute =1

    Every permission represented by a number as shown, and you can combine permissions.

    owner: set it to 7, which means 4+2+1 means read+write+execute.

    group: set it to 5, which means 4+1 means read+execute.

    other: set it to 5, which means 4+1 means read+execute.

  3. To check which commands you have run till now .

    history:- history command is used to view the previously executed command.

  4. To remove a directory /Folder.

    rm :- rm command is used to delete file and directory

    rm -r - to remove files/dir. recursively.

    rm -rf - it will remove files/dir. recursively and forcefully.

  5. To create a fruits.txt file and to view the content.

    touch :- touch command is used to create an empty file.

    cat :- Cat(concatenate) command is very frequently used in Linux. It reads data from the file and gives its content as output. It helps us to create, view, and concatenate files.

  6. Add content in devops.txt (One in each line)- Apple, Mango, Banana , Cherry, Kiwi, Orange , Guava.

    cat :- It reads data from the file and gives its content as output. It helps us to create, view, add data in files, append data in files and concatenate files.

    echo :- echo command is used to (>)add content in a file and (>>) to append text at the end.

  7. To show only top three fruits from the file.

    head:- print the top N number of data of the given input. By default, it prints the first 10 lines of the specified files.

    syntax:

    head <file_name> : Prints the first 10 lines

    head -n <file_name> : Prints the first ‘n’ number lines instead of first 10 lines

  8. To show only the bottom three fruits from the file.

    tail:- Used to display bottom line of a file. By default, it prints the last 10 lines of the specified files.

    syntax:

    tail <file_name> : Prints the last 10 lines

    tail -n <file_name> : Prints the last ‘n’ number lines instead of first 10 lines

  9. To create another file Colours.txt

    touch :- touch command is used to create an empty file.

  10. Add contents in Colours.txt (One in each line) - Red, Pink, White, Black, Blue, Orange, Purple, Grey.

  11. To find the difference between fruits.txt and Colours.txt file.

    diff - Used to find differences b/w two files.

    Thank you for reading this Blog. If you found this blog helpful, please like, share, and follow me for future blogs. Any feedback or remarks will be highly appreciated.

    I would like to connect with you at https://www.linkedin.com/in/priyanka-yadav-1966a11b3/