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 stands for substitute user identity. If you want to switch to a root user who has all the permission.
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.
|-b, –background||Run commands in the background.|
|-D directory, –chdir=directory||Run Command is Specified Directory instead of current working Directory|
|-e, –edit||Edit one or more files instead of running a command.|
It is used to create files on your system.
|-a||Change the access time of the file|
|-c||Do not create the file if it does not exist.|
|-f||Attempt to force the update, even if the file permissions do not currently permit it.|
|-m||Change 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 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.
To save press escape and then
To read, modify, concatenate files then you can use the cat command. It is used to display the content of the file.
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.
|-n||This does not override the file.|
|-u||This flag updates the destination file only if the source file is different from the destination file.|
|-R||This command is recursive copying directories and this command even copies the hidden file.|
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.
If you want to search pattern/text on file then you use the grep command
grep <Pattern> <File>
|-v||It returns the result of lines not matching the search string.|
|-n||This command returns the line number of the matching string.|
|-c||It returns a number of lines in which the result match the search string.|
sort utilities sort the result of a search either alphabetically or numerically. File, File content or directory can be sorted using this command.
|-r||This command returns the final result in reverse order.|
|-f||Irrespective of the Case this flag will sort the file.|
|-n||Return result in numeric order.|
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>
It gives memory information such as used memory, shared memory, total memory etc.
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>
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
It is used for network statistics. These command-line tools are used to display the current network connection and port activity on your system.
|-n||It shows the IP address of the Computer instead of the name of the Computer.|
|-a||Display active connections and which TCP & UDP ports are listening for a connection.|
|-b||It 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.