Important Linux Commands for DevOps

maxresdefault

In this blog, I will cover Most Important Linux Commands for DevOps which they often use in daily life. In the previous blog, I have discussed the Basic Commands of Linux, LvExtend Command, GroupMod Command and Many more.

I will be covering the entire command line part which is an essential part of DevOps. The topics that we will cover here are as follows 

su

su stands for substitute user identity. If you want to switch to a root user who has all the permission.

Screenshot 2021 08 26 at 4.19.31 PM

sudo

This command is for the user who doesn’t have proper permission or privileges for executing some commands or operations in that case you have to use sudo command. For Example. Adding a user is mostly done by the root user and if some user doesn’t have a root, he needs to use sudo.

Flag:

CommandDescription
-b, –backgroundRun commands in the background.
-D directory, –chdir=directoryRun Command is Specified Directory instead of current working Directory
-e, –editEdit one or more files instead of running a command.

touch

It is used to create files on your system.

Screenshot 2021 08 26 at 4.28.09 PM
CommandDescription
-aChange the access time of the file
-cDo not create the file if it does not exist.
-fAttempt to force the update, even if the file permissions do not currently permit it.
-mChange the modification time of the file.

Text Editor Command

There are many Text Editor Command such as Vim, nano, vi and many more. In this we will discuss vi command

vi

vi editor command is the most popular and classic text editor in a Linux family. To open the file type sudo vi infohubblog.txt . After opening the file to enter text press i for inserting.

Screenshot 2021 08 26 at 4.34.22 PM

To save press escape and then :wq .

cat

To read, modify, concatenate files then you can use the cat command. It is used to display the content of the file.

cat infohubblog.txt
Linux Commands for DevOps

cp

cp is a copy command. It is used to copy files or directories. The file or directory once copied will be available in another location. The file still remains in the working directory after copying.

Linux Commands for DevOps

Flags:

CommandDescription
-nThis does not override the file.
-uThis flag updates the destination file only if the source file is different from the destination file.
-RThis command is recursive copying directories and this command even copies the hidden file.

mv

This command is used to move the file or directory from one location to another. The file or directory once moved is removed from the current working directory.

Linux Commands for DevOps

grep

If you want to search pattern/text on file then you use the grep command

grep <Pattern> <File>
Linux Commands for DevOps
CommandDescription
-vIt returns the result of lines not matching the search string.
-nThis command returns the line number of the matching string.
-cIt returns a number of lines in which the result match the search string.

sort

sort utilities sort the result of a search either alphabetically or numerically. File, File content or directory can be sorted using this command.

Linux Commands for DevOps
CommandDescription
-rThis command returns the final result in reverse order.
-fIrrespective of the Case this flag will sort the file.
-nReturn result in numeric order.

chown

It is used to change the owner of files. Different users in operating systems have their own ownerships and the permission to ensure that the files are secure and put restrictions on who can access or modify the contents of the file.

In Linux, various users can utilize the system so each user has few properties associated with them, like User ID and Home Directory. We can add users into groups to make the process of managing the users. Easier a group can have 0 or more

SYNTAX : chown <ownersname> <Dir/Filename>

free

It gives memory information such as used memory, shared memory, total memory etc.

Linux Commands for DevOps

ssh

While working in DevOps you frequently use this command the SSH command. SSH means Secure Shell. This command refers to cryptographic network protocol for operating network services securely over unsecured Networks. It is used for remote login programs.

Suppose if you have two nodes – Master & Slave. If you want to access the Master node from the Slave node then you can simply use ssh.

SYNTAX ssh <user>@<IP>

ssh-keygen

This is used to generate public-private authentication key pair. The authentication key allows you to remote login without a password. The public key must be kept in the authorized key in order to allow remote login without a password.

ssh-keygen -t rsa -b 4096
Linux Commands for DevOps

netstat

It is used for network statistics. These command-line tools are used to display the current network connection and port activity on your system.

Linux Commands for DevOps
CommandDescription
-nIt shows the IP address of the Computer instead of the name of the Computer.
-aDisplay active connections and which TCP & UDP ports are listening for a connection.
-bIt displays the name of the Program/Software which is used to make the connection.

Hope you like our Linux Commands for DevOps blog. Please subscribe to our Blog for upcoming posts.

Happy Coding!

1 Comment on "Important Linux Commands for DevOps"

  1. ElegantITServices | April 12, 2022 at 1:14 pm | Reply

    Great information. Thanks for sharing

Leave a comment

Your email address will not be published.


*