Linux Commands Cheat Sheet for Devops [Free PDF Download]

Linux commands are an essential component of any DevOps engineer’s toolkit. When working as a DevOps engineer, you’ll probably need to use Linux commands for a variety of tasks, including managing servers, automating processes, and troubleshooting problems. A Linux commands cheat sheet for DevOps can be useful in this situation. So, in this article, the essential Linux commands frequently used in DevOps will be listed in detail with a  comprehensive cheat sheet.

Download Linux Commands Cheat Sheet for DevOps

Linux commands cheat sheet for DevOps

Available Download Options


Most Popular

PDF (3 Pages)

DOC (3 Pages)

Combo Pack

ZIP (pdf, docx, png)

Why Linux is Used for DevOps?

DevOps is a software development methodology that prioritizes collaboration and communication between development and operations teams. Linux is the preferred operating system for many DevOps teams due to its open-source nature, security, flexibility, automation, and containerization capabilities.

Users can easily modify their source code, and its security features include file permissions, firewalls, and encryption, which help protect systems and data from attacks. Also, Linux offers various automation tools like shell scripts, cron jobs, and other utilities that help to automate various tasks in the DevOps pipeline. Moreover, Linux offers various containerization technologies like Docker, Kubernetes, and LXC, which enable devops to create and deploy applications quickly.

Linux Commands Cheat Sheet for DevOps

Being proficient in Linux commands is essential for any developer, sysadmin, or IT professional in today’s fast-paced world of DevOps. I hope you will find all the necessary commands in this list that will help you become more productive and efficient at work.

File and Disk Management Commands

Here, I have included all the file and disk management commands that you will need for navigation through files and directories. Some commands for displaying contents, changing permissions, and extracting information about disks and files are also included:

Command Description
ls Lists files and directories in current directory
ls -l Lists files and directories with information  such as permissions, ownership, size, and modification date
ls -a Lists all files and directories including hidden ones
cat -b Inserts line numbers to non-blank lines
cat -n Inserts line numbers to all lines
cat -s Squeezes multiple blank lines into a single blank line while displaying the file contents
cat –E Displays contents of a file ending with a $ symbol in each line
chmod Changes permissions of a file or directory
chown Changes ownership of a file or directory
tail Displays last 10 lines of a specified file
dd Copies raw data from one file/ device to another
find Finds files and directories based on specific criteria
scp Copies securely  files between hosts on a network using SSH (Secure Shell) protocol
df Estimates space used by entire file system
du Displays the amount of disk space used by individual file

User and Group Management Commands

You will find the user and group management commands useful for managing user accounts and groups. You will be able to control access to files, directories, and other resources on the system. Also, some commands allow you to verify user and group information, troubleshoot permissions issues, and manage user and group access to resources on a system:

Command Description
sudo useradd <username> Creates a new user account with the specified username
sudo passwd <username> Changes the password for the specified user
sudo userdel <username> Deletes the specified user account from the system.
sudo groupadd <groupname> Creates a new group with the specified group name
sudo groupdel <groupname> Deletes the specified group from the system
sudo usermod -g <groupname> <username>  Modifies the primary group of the specified user to the specified group
id Displays the user ID (uid) and group ID (gid) of the current user
id -g <groupname> Displays the group ID (gid) of the specified group
id -u <username> Displays the user ID (uid) of the specified user
id <username> Displays the user ID (uid), group ID (gid), and supplementary group IDs (sgid) of the specified user

System Monitoring Commands

As a DevOps professional, you will use these system monitoring commands for troubleshooting file access problems. Moreover, you will use the following commands for identifying processes and files that are opened:

Command Description
lsof Lists all files opened by any process of a system
lsof -u username Lists all files opened by a user

Pattern Searching Commands

To search for a specific pattern in files, you may find this grep command with different options:

Command Description
grep -i Performs a case-insensitive search
grep -n Displays the line numbers of the matched pattern
grep -v Inverts the search and displays all lines that do not match the pattern
grep -c Shows a count of the number of lines that match the pattern

Network Configuration and Monitoring Commands

You are going to need these network configuration and monitoring commands to troubleshoot network-related issues and gather information about the configuration of a system:

Command Description
ifconfig Displays network interface configuration information, such as IP address, netmask, and broadcast address
ifconfig -a Displays all interface available even if those are down
ifconfig -s Displays short list of network interface
ip Displays and manages routing, devices, and tunnels
ip address Displays all IP addresses related with all network devices
ip link Shows all network interfaces available on the system
nslookup Queries the DNS server for information about a domain name or IP address
curl Facilitates the transfer of data to or from a server, using any of the protocols it supports, such as HTTP, HTTPS, FTP, FTPS, SCP, SFTP, TFTP, DICT, TELNET, LDAP, or FILE
telnet Client-server protocol used to establish a connection to a remote computer
netstat Displays network connections and network statistics, such as active sockets, routing tables, and network interface statistics
ss-keygen Creates a pair of public and private authentication keys
route  Access the Linux kernel’s routing tables
nmap Scans hosts and services on a network, and provides information about operating systems, open ports, and services running on the hosts
iptables Sets up, maintains, and inspects the tables of IPv4/IPv6 packet filter rules in the Linux kernel firewall

System Information Commands

I have listed some system information commands in this section that you will need to manage computer systems and software development:

Command Description
unmae -o Displays the operating system name
uname -m Displays the machine hardware name
uname -r Displays the kernel release number
lshw Lists hardware information of the system.
lscpu Displays information about the CPU
history Displays the list of previously executed commands
free Displays the amount of free and used memory in the system

Text Manipulation Commands

Suppose you want to manage a large amount of data and want to automate tasks in a DevOps environment. Then you should learn these commands for file manipulation and organization:

Command Description
sort -r Sorts the output in reverse order
sort -f Sorts the output ignoring the case
sort -n Sorts the output numerically.
cut Extracts specific portion from a file or input stream
diff Compares two files and displays the differences between them
sed Editor used for modifying text
tr Translates or deletes characters from standard input and writes to standard output
uniq  Filters out duplicate lines in a file

Process Management Commands

To manage processes in real-time and list out running packages, you can learn the commands given below:

Command Description
htop Interactive process viewer that displays system resource usage in real-time
ps Lists information about currently running processes
kill Sends a signal to a process to terminate it

Package Management Commands

If you want to install, search or remove a package in your system, the following package management commands can be very useful:

Command Description
apt -get Handles packages on Ubuntu-based systems
apt search Searches for packages matching a given package name
sudo apt-get remove Removes a package from the system

Docker Commands for DevOps

In this section, I am going to discuss some docker commands for DevOps that can be used to manage docker containers:

Command Description
getent Retrieves entries from databases, such as the user and group database or the Domain Name System (DNS) database
docker ps Lists all active Docker containers
docker images Lists all Docker images on user’s machine
docker build Builds a Docker image from a Dockerfile
docker run Runs a Docker container
docker stop Stops an active Docker container
docker-compose up Starts containers defined in a docker-compose.yml file
docker-compose down Stops and removes containers defined in a docker-compose.yml file

Git Commands

You must keep all of your communication in Version Control if you want to be successful with DevOps. Here comes the role of Git, an open-source distributed version control system. Here, I have discussed the git commands that you will find essential:

Command Description
git init Initializes a new and empty Git repository.
git clone Creates a copy of a Git repository in a new directory from an existing URL
git add Adds changes to the staging area in preparation for committing them to the repository
git commit Records changes to the repository with a message describing the changes
git status Shows the current status of the repository, including any changes that have been made but not yet committed
git show Displays information about a specific commit or object
git rm Removes files from the repository and stages the deletion
git remote Connects remote server with the local repository
git push Sends committed changes to a remote repository
git pull Fetches changes from a remote repository and merges them into the local repository
git branch Lists, creates, or deletes branches within the repository
git checkout Switches between different branches or creates a branch and switches to it
git merge Combines specified branch’s history into the current one
git rebase Moves all work from the current to the master branch

Conclusion

Linux is considered to be the ideal operating system for DevOps. In this article, I attempted to cover the most important DevOps commands in Linux. I hope the attached Linux commands cheat sheet for DevOps will help you have a firm grasp of these commands.

People Also Ask

Which Linux is best for DevOps?

The most widely used Linux operating system for DevOps is Ubuntu, which is both user-friendly and supported by a large community. It provides a broad selection of pre-loaded software and tools, making it an ideal choice for both novice and experienced users.

What are the 4 areas of DevOps?

DevOps goals are categorized into four distinct areas: culture, automation, measurement, and sharing. DevOps tools can support these areas.

How Linux is used in DevOps?

DevOps engineers utilize the command line interface (CLI) to create scripts, automate operations, and manage systems, resulting in streamlined and efficient operations.

What is the docker commands cheat sheet for DevOps?

The docker commands cheat sheet for DevOps is the sheet containing essential commands to maintain docker containers. Some of the docker commands are given below:

  1. getent: Retrieves entries from databases, such as the user and group database or the Domain Name System (DNS) database.
  2. docker ps: Lists all active Docker containers.
  3. docker images: Lists all Docker images on user’s machine.
  4. docker build: Builds a Docker image from a Dockerfile.
  5. docker run: Runs a Docker container.
  6. docker stop: Stops an active Docker container.

4.8/5 - (9 votes)
LINUX
FUNDAMENTALS
A Complete Guide for Beginners Enroll Course Now
icon linux

Lamisa Musharrat

Hello there. My name is Lamisa Musharat, and I'm an Linux Content Developer Executive at SOFTEKO. I earned a bachelor's degree in Naval Architecture and Marine Engineering from Bangladesh University of Engineering and Technology (BUET).I learned Linux out of my curiosity and now I find it useful as automation is easier using Linux. I take great pleasure in assisting others with Linux-related issues. I really want you to enjoy and benefit from my efforts.Read Full Bio

Leave a Comment