Linux commands for DevOps (Commands used in day-to-day activities).
Mostly Used Commands in DevOps:
if you run ls -l, it will show the permissions, owner, size, and last modified date for each file in the directory.
2. Sudo: This command executes only that command with superuser privileges.
3. Pwd: This command will print your directory location, where you currently working.
4. Cat: This is used to concatenate and display files on the terminal. It can also be used to modify existing ones.
cat -b: This adds line numbers to non-blank lines
cat -n: This adds line numbers to all lines
cat -s: This squeezes blank lines into one line
cat –E: This shows $ at the end of the line
5. Vim: This is a text editor used in Linux. It stands for “Vi Improved”.
Mostly used modes in VIM:
6. Grep: This command searches for a particular string/ word in a text file. This is similar to “Ctrl+F” but executed via a CLI.
This would print all of the lines in “chxtan.txt” that contain the word “This".
7. Sort: This command is used to sort the results of search either alphabetically or numerically. It also sorts files and directories.
sort -r: the flag returns the results in reverse order.
sort -f: the flag does case-insensitive sorting.
sort -n: the flag returns the results as per numerical order.
8. Tail: This command prints the last N number of data of the given input. By default, it prints 10 lines.
We can specify the number of lines, that we want to display.
9. Chmod: This command is used to change the access permissions of files and directories.
For example: Following “chmod” command will give the user permission to read, write and execute a file.
10. Chown: This command is used to change the file Owner or group.
Here, below the ownership of “Chetan.txt” file got changed to root.
11. Ping –?This command will ping a host and check if it is responding.
12. Lsof: It is used to display a list of all the open files on a Linux system.
13. Ifconfig: This is used to configure the kernel-resident network interfaces.
14.?ID: This is used to find out user and group names and numeric ID’s (UID or group ID) of the current user or any other user in the server.
Syntax: id <option> <user_name>
15. Cut: This command is used to extract specific fields or columns from a file or standard input.
It is often combined with other commands, such as sort, uniq, and grep, to perform more complex text-processing tasks.
领英推荐
16. Sed: This is used to perform basic text transformations on an input file. It stands for "stream editor" and is a powerful tool for editing text files or streams in a Linux environment.
17. Diff: This command is used to find the difference between two files.
18. History: This command is used to view the previously executed command.
“History 10” – Will give you the last 10 executed commands.
?
19. Find: This is used to find files and directories and perform subsequent operations on them.?
In the below command, It will search in the present working directory and its subdirectories, and print the name of the file that have “.txt” file extension.
?
20. Free: This command displays the total amount of free space available along with the amount of memory used and swap memory in the system, and also the buffers used by the kernel.
?
21. ssh user@host –?connect to the host as a user.
22. Ssh-keygen: This command is used to generate a public/private authentication key pair.
This process of authentication allows the user to connect remote server without providing a password.
(This authentication method we will use to authenticate the server with Jenkins while deploying CI/CD pipelines).
?
23. Nslookup: This stands for “Name server Lookup”. This is a tool for checking DNS hostname to Ip or Ip to Hostname. This is very helpful while troubleshooting.
24. Curl: Curl is a tool used for transferring data to or from a server, using various protocols, such as HTTP, HTTPS, FTP, and more. Basic example:
Syntax: curl <url>
?-o: It will save downloaded file on the local machine with the name provided in parameters.
25. Tr: Tr stands for translation. This command is for translating or deleting characters.?
?
26. Apt-get: This command is used to install, update, and remove packages, as well as to manage the package repository sources.
Here are some common apt-get commands:
?
27. Df, du:
Df (disk free) command will have an account of available disk space, used by file system.
Du (disk usage) command reports the size of directory tree including all the content.
??
28. Htop: This command is used to monitor the system’s resources and processes that are running in real time.
?
29. Ps: We use ps command to check the unique id behind every process.
?
30. Kill: This command is used to terminate processes manually. This command basically, will send a signal that terminates it.
?
31. TNC: This is “Test Network Connection” command. Mostly used command while troubleshooting. It displays diagnostic information for a connection.
?
Command: tnc <server_name> -port <port>
DevOps Engineer || Cloud Administration
1 个月Talha Altaf Muhammad Ahsan Rizwan
........
3 个月Really Helpful!
Cloud & Server Administrator | AWS | Azure | GCP | DevOps Enthusiast
1 年awsesome
AI/ML Engineer | AWS Certified Machine Learning – Associate | AI/ML & Cloud Automation Enthusiast | Specializing in Generative AI & Scalable ML Pipelines on AWS
1 年really useful Chetan R ?? , thanks for sharing.
Aspiring DevOps Engineer || Seeking Entry-Level Position || Experience With Linux | AWS | Git | Jenkins | apache | Docker | Kubernetes | Terraform | Ansible | Chef |
2 年ls -a Using ‘a’ flag, lists all the hidden contents in the specified directory