
A Concise Linux Command Cheat Sheet for DevOps Learners


Prerana Maurya
- February 7, 2025
In this blog, you’ll learn the important Linux commands that every DevOps professional needs. These commands help you do basic things like finding files and changing folders, as well as more advanced tasks like controlling programs and connecting to networks. Whether you’re just starting, or want a quick refresher, these commands are essential for working in DevOps.
Introduction to Linux OS
Linux (Linux+GNU) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released in 1991, by Linus Torvalds.
Several Linux distributions, such as Ubuntu, Kali Linux, and Red Hat, are also released. These distributions consist of the Linux kernel and a collection of software packages tailored to specific needs and preferences.
Architecture of Linux
Cloud computing is on demand delivery of compute power, database, storage, application and other IT resources through a cloud service platform via the Internet with a pay-as-you-go pricing model.
Understanding the DevOps Mindset

The Linux architecture consists of the kernel, which acts as the core managing system resources, and the shell, which is a command-line interface that allows user interaction. The kernel controls hardware and runs processes, while the shell interprets user commands. Together, they form the backbone of Linux, providing functionality and flexibility.
What is Linux Shell?
A shell provides an environment to a user to execute commands and interact with kernel. There are various types of shells like bash shell , korn shell , c shell etc , each with unique features.
What are Linux Commands ?
Linux commands are instructions given to a Linux operating system via the command line interface (CLI) to perform various tasks such as managing files, directories, processes, and system configurations.
Essential Linux Commands For DevOps
Section 1: Basic Linux Commands
Working with Linux often involves using these core commands to perform everyday tasks. Here’s a brief description of each one you’ll encounter frequently:
ls
: Lists files and directories in your current location.cd
: Changes the directory you are currently working in.pwd
: Displays the current directory path you are working in.mkdir
: Creates new directories to organize files.rm
: Removes files or directories from the system.cp
: Copies files or directories to a specified location.cat
: Displays the contents of files directly in the terminal.grep
: Searches for specific text patterns within files.chmod
: Changes file or directory permissions to control access.chown
: Alters file or directory ownership.sudo
: Executes commands with administrative (superuser) privileges.man
: Opens the manual pages for detailed command usage and options.
These are the commands you’ll frequently use to navigate, manage, and manipulate files and system settings in a Linux environment.
Section 2: File Management and Manipulation
These Linux commands are essential for managing files and directories effectively. They allow you to compress and decompress files, search for specific files, edit and process text, compare differences, sort and remove duplicates, and create or extract archives. Mastering these commands simplifies day-to-day file handling and ensures efficient data management in any Linux environment.
gzip
/gunzip
: Compress (gzip
) or decompress (gunzip
) files to save space.Example:
gzip file.txt
(compress),gunzip file.txt.gz
(decompress).find
: Search for files or directories based on name, type, or other criteria.Example:
find /path -name file.txt
(search forfile.txt
in/path
).sed
: Stream editor for text manipulation, such as search and replace.Example:
sed 's/old/new/g' file.txt
(replace “old” with “new” infile.txt
).awk
: Text-processing tool to extract and manipulate data from files.Example:
awk '{print $1}' file.txt
(print the first column offile.txt
).diff
: Compare two files line-by-line to show differences.Example:
diff file1.txt file2.txt
(display differences between the files).sort
: Sort lines in a file alphabetically, numerically, or by other criteria.Example:
sort file.txt
(sort the lines infile.txt
alphabetically).uniq
: Remove duplicate lines from sorted input.Example:
uniq sorted_file.txt
(remove duplicates fromsorted_file.txt
).wc
: Count words, lines, and characters in a file.Example:
wc -l file.txt
(count lines infile.txt
).tee
: Read standard input and write it to both a file and standard output.Example:
echo "Hello" | tee output.txt
(write “Hello” to both terminal andoutput.txt
).tar
: Archive files and directories into a single file or extract them.Example:
tar -cvf archive.tar file1 file2
(create an archive).Example:
tar -xvf archive.tar
(extract an archive).
Section 3: Process Management
In Linux, a process is any running instance of a program or command. Process management involves monitoring, controlling, and optimizing these processes to ensure system performance, stability, and efficient resource utilization. These commands help you view running processes, prioritize them, terminate them when needed, and schedule tasks for automated execution.
ps
: Display details of active processes running on the system.Example:
ps aux
shows all running processes with detailed information.top
: Monitor system processes and resource usage in real time.Example: Run
top
to view CPU and memory usage interactively.kill
: Terminate a process by specifying its PID (process ID).Example:
kill 12345
stops the process with PID 12345.nice
: Start a process with a specified priority to manage resource allocation.Example:
nice -n 10 command
runscommand
with a lower priority.nohup
: Run a process in the background immune to logout or hangup signals.Example:
nohup command &
keepscommand
running after logout.cron
: Automate repetitive tasks by scheduling commands or scripts.Example: Add a task to
crontab
with* * * * * /path/to/script.sh
to run a script every minute.
Section 4: Networking
Networking commands in Linux are essential for managing and troubleshooting network configurations, connectivity, and data transfer. These commands enable users to inspect interfaces, test connections, transfer files, and interact with remote systems, making them vital for system administrators and developers.
ifconfig
: Used to view and configure network interface settings, including IP addresses, netmasks, and broadcast addresses.Example:
ifconfig eth0
displays the configuration details of theeth0
network interface.ping
: Tests the connectivity to a host by sending ICMP echo requests, helping diagnose network issues.Example:
ping google.com
checks if Google is reachable and measures the round-trip time for packets.netstat
: Provides information on network connections, routing tables, and protocol statistics, useful for monitoring and troubleshooting.Example:
netstat -an
lists all active network connections and their states.ssh
: Establishes a secure connection to a remote system, often used for remote management and file transfer.Example:
ssh user@hostname
logs into a remote server asuser
.scp
: Securely copies files between local and remote systems over SSH, ensuring encrypted file transfers.Example:
scp file.txt user@remote:/path/
copiesfile.txt
from the local system to a remote server.curl
: Transfers data to or from a server using various protocols, such as HTTP, FTP, or HTTPS, often used for API testing and downloading files.Example:
curl <http://example.com
> fetches the content of the webpage atexample.com
.wget
: A command-line tool to download files from the web non-interactively, supporting resumption of interrupted downloads.Example:
wget <http://example.com/file.zip
> downloadsfile.zip
fromexample.com
.
Section 5: User Management
User management in Linux is a key part of system administration, enabling administrators to manage users, groups, and permissions. It requires administrative privileges to execute most commands.
less /etc/passwd
: Displays details of all user accounts.Example:
less /etc/passwd
shows user information like username, user ID (UID), and home directory.less /etc/group
: Lists all groups and their members.Example:
less /etc/group
displays group details.less /etc/shadow
: Contains user account information, including encrypted passwords (requires root access).Example:
less /etc/shadow
shows detailed password and account expiration details.useradd
: Adds a new user to the system.- Example:
useradd shan
- Example:
userdel
: Deletes a user account from the system.- Example:
userdel shan
- Example:
usermod
: Modifies an existing user’s account properties.- Example:
usermod -g dev shan
- Example:
passwd
: Changes or sets a password for a user.- Example:
passwd shan
- Example:
groupadd
: Creates a new user group.- Example:
groupadd dev
- Example:
groupdel
: Deletes an existing user group.- Example:
groupdel dev
- Example:
su
: Switches to another user account or root.- Example:
su - shan
- Example:
Section 6: Memory Management
Memory management is an essential aspect of any operating system, ensuring that the system’s resources are used efficiently and that processes have access to the necessary memory for execution. In Linux, there are several commands that help in monitoring and managing system memory, providing insights into physical and virtual memory, disk space, and file usage.
top
: Displays a real-time list of running processes, system resource usage, and performance statistics.- Example:
top -o %MEM
(Sort processes by memory usage).
- Example:
free
: Provides a snapshot of system memory, including total, used, and available physical and swap memory.- Example:
free -m
(Display memory in megabytes).
- Example:
vmstat
: Monitors system performance and displays information about processes, memory, paging, block I/O, disk, and CPU.- Example:
vmstat
(Show system performance statistics).
- Example:
df
: Shows disk usage for all mounted filesystems, including total size, used, and available space.- Example:
df -h
(Display disk usage in a human-readable format).
- Example:
du
: Displays the size of a directory or subdirectory.- Example:
du -sh
(Show the size of a directory in human-readable format).
- Example:
stat
: Provides detailed information about a file or directory, such as access, modify, and change times.- Example:
stat <filename>
(Show details of the specified file).
- Example:
Conclusion
Mastering Linux commands is crucial for anyone working in DevOps. These commands help you efficiently manage files, monitor system processes, troubleshoot network issues, and handle user and system administration tasks. By learning and using these basic Linux commands, you’ll boost your productivity and streamline your workflow in any Linux environment.
Whether you’re a beginner or looking to refresh your skills, these commands form the foundation of DevOps practices. Understanding them will enable you to automate tasks, improve system management, and enhance your overall efficiency in development and deployment. Mastering Linux is an essential step towards becoming a proficient DevOps professional.