Sudo Mastery: The Linux Essentials Every DevOps Engineer Needs


Hey everyone,in this blog I am going to revisit all the needful commands one should definitely know before starting their devops journey,not only their functions I will also state how they are used in this very domain. So be ready with your terminal running.
🔹 1. Shell Navigation & File Operations
These commands are your basic survival toolkit in the Linux shell. They help you move around, list, create, and manage files and directories.
Making a directory and navigating through it
mkdir Linux_Basics
cd Linux_Basics
touch shellcommands.txt
🧠Explaination
mkdir
→ creates a directory named Linux_Basics
cd
→ changes current directory to Linux_Basics in terminal
touch
→ creates a file named shellcommands.txt
🧠Bonus
cd ..
can be used to move to previous directory
files can be created using many commands like cat
,echo
and nano
where echo expects the content of the file beforehand
echo "Hello, DevOps World!" > greeting.txt
and nano
lets you edit the file in the terminal itself.
Removing files
Often devs like me mess up with project configuration files so irreversibly that its easier to start over rather than trying and fixing the issue.
rm -rf Vueproject/
🧠Explanation:
Deletes the
Vueproject/
directory and all its contents.-r
: Recursive,-f
: Force (no confirmation). Use with caution.
Example: Move all files from source_dir
to target_dir
We often need to transfer all the files of code from a directory which was not intended for the project in that case this command comes in very handy
mv source_dir/* target_dir/
🧠What it does:
mv
— move command.source_dir/*
— selects all files and folders insidesource_dir
.target_dir/
— the directory where you want to move them.
🔹 2. File Permissions & Ownership
Linux uses a permission model that controls who can read, write, or execute files. Let’s explore how to inspect and change those settings.
Listing files and checking file permissions
ls -laht ~
🧠Explanation:
ls → List directory contents
-l → Use a long listing format permission bits (e.g.,
-rw-r--r--
)-a → Show hidden files
-h → Display sizes in human-readable format (e.g., KB, MB)
-t → Sort by modification time (newest first)
~ → Home directory
Changing ownership and setting permissions
You’ve created a directory /opt/devops_logs
that should only be accessed by a user named devops_user
. No one else should have read or write access
1️⃣ Create the directory:
sudo mkdir /opt/devops_logs
2️⃣ Change ownership to devops_user
:
sudo chown devops_user:devops_user /opt/devops_logs
chown
— changes the owner and group of the directory.devops_user:devops_user
— sets both the owner and group todevops_user
./opt/devops_logs
— the target directory.
3️⃣ Restrict access using chmod
:
sudo chmod 700 /opt/devops_logs
chmod 700
— sets permissions to:rwx------
→ only the owner can read, write, and execute.
This prevents all other users from accessing the directory.
🔹 3. Process Management and disk space monitoring
In Linux, processes represent running programs. Understanding how to monitor, prioritize, and control them is crucial for maintaining system health and performance and disk space.
Finding the total disk usage of the /var/log directory in human-readable format.
du -sh /var/log
🧠Explanation:
du → Disk usage command
-s → Summarize total size instead of listing all files
-h → Human-readable format (e.g., KB, MB, GB)
Using top
/ htop
top
is a built-in command-line tool that displays real-time system processes.htop
is a more user friendly enhanced version.
Start it:
top|htop
What you'll see:
CPU usage
Memory usage
Running processes
Process IDs (PID), users, etc.
To find a specific process (e.g., python
):
Press
/
→ type the process name (e.g.,python
) → press Enter.It will highlight the matching process.
Kill a Process Manually with kill
kill 1234 # Sends SIGTERM (soft kill)
kill -9 1234 # Sends SIGKILL (force kill)
replace 1234 with process id
🧠Bonus: Find PID with ps
+ grep
ps aux | grep python
Then use kill
or htop
as shown.
df
– Disk Free Space
Usage:
df -h
Explanation:
Displays available and used disk space for all mounted filesystems.
-h
makes the output human-readable (e.g., GB, MB).Useful to detect disk space issues quickly.
uptime
– System Load and Uptime
Usage:
uptime
Explanation:
Displays how long the system has been running, number of users, and system load averages for 1, 5, and 15 minutes.
Useful for quick health checks.
vmstat
– Virtual Memory Statistics
Usage:
vmstat 2 5
Explanation:
Reports on memory, swap, I/O, system, and CPU usage.
The above command prints stats every 2 seconds, 5 times.
Helps diagnose CPU/memory performance issues.
iostat
– I/O Statistics
Usage:
iostat -xz 1
Explanation:
Reports CPU and device I/O stats.
-x
: Extended statistics-z
: Suppress devices with no activity1
: Update every secondExcellent for identifying disk bottlenecks.
🔹 4. Package Management (Debian/Ubuntu)
Managing software is one of the most important tasks for a DevOps engineer. Debian-based systems like Ubuntu use apt
and dpkg
to install, remove, and manage software packages.
apt remove
– Remove Installed Package
Usage:
sudo apt remove nginx
apt purge
– Remove Package and Config Files
Usage:
sudo apt purge nginx
apt autoremove
– Remove Unused Dependencies
Usage:
sudo apt autoremove
🔹 5. Remote Access & Transfer
DevOps engineers often manage remote servers and need to transfer files securely. These commands are essential for file transfers and interacting with web endpoints from the command line,let’s explore a few.
wget
– Download Files from the Web
wget https://example.com/file.zip
📘 Explanation:
wget
is a non-interactive command-line tool to download files from the internet.This command downloads
file.zip
from the specified URL.It works with HTTP, HTTPS, and FTP protocols.
ping
– Test Network Connectivity
ping -c 4 -w 5 google.com
📘 Explanation:
Sends ICMP echo request packets to a host.
Helps you test if a server or host is reachable.
By default, it keeps sending packets until interrupted.
-c 4
: Send only 4 packets.-w 5
: Ping for 5 seconds.
Using curl
:
curl https://example.com
This will print the raw HTML content of the homepage of example.com
directly to your terminal.
That wraps up the Linux Essentials Every DevOps Engineer Needs!
You now have a working knowledge of:
✅ Shell navigation
✅ Filesystem hierarchy
✅ Permissions & ownership
✅ User/group management
✅ Process handling
✅ Monitoring systems
✅ Managing packages
✅ Connecting & transferring remotely
You can follow me on my socials LinkedIn,Twitter and checkout my Github profile.
Subscribe to my newsletter
Read articles from Prianshu Mukherjee directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
