Essential Linux Commands Every DEVOPS Engineer Should Know Part 1
Updated: March 27, 2026
TL;DR
Master essential Linux file and directory commands (ls, cd, mkdir, cp, rm, chmod) plus modern replacements like eza and bat, systemd/journalctl for service management, and container-aware tools for effective DevOps workflows.
Whether you're managing bare-metal servers, Kubernetes clusters, or cloud infrastructure, Linux command-line proficiency is non-negotiable for DevOps engineers in 2026. The commands you'll learn here form the foundation of daily infrastructure work — from navigating filesystems to managing permissions and container environments.
While traditional Linux commands remain relevant, modern alternatives like eza (replacing ls) and bat (replacing cat) offer better syntax highlighting, colored output, and improved readability. Combined with systemd mastery and Windows Subsystem for Linux 2 (WSL2) for Windows developers, these tools compose a complete DevOps toolkit.
File and Directory Navigation Commands
The most fundamental operations in Linux involve moving through the filesystem and understanding what's where. These commands haven't changed much, but their modern replacements have made them more efficient.
Traditional and Modern Approaches:
# Old way: ls (lists directory contents)
ls -la # List all files, detailed format
# Modern replacement: eza (faster, colored, Git-aware)
eza -la # Same output, with better colors
eza -la --tree # Directory tree view
eza -la --git # Shows Git status alongside files
The eza tool handles large directories faster and automatically colors output for permissions, file types, and Git status — useful when navigating a monorepo with hundreds of files.
Navigation:
pwd # Print working directory (where are you?)
cd /path/to/dir # Change directory
cd ~ # Go to home directory
cd - # Go to previous directory
cd .. # Go to parent directory
cd ../.. # Go up two levels
File Inspection and Reading
cat displays file contents, but for large files or code reading, modern alternatives are superior:
# Old way: cat
cat /var/log/syslog # Print entire file to terminal
# Better alternatives:
bat /var/log/syslog # Syntax highlighting + line numbers
bat -p /var/log/syslog # Plain mode (no line numbers)
tail -f /var/log/syslog # Follow log file in real-time
head -20 /var/log/syslog # First 20 lines only
For DevOps work, bat is indispensable for reading configuration files and code snippets with proper syntax highlighting. The tail -f command is critical for monitoring logs in real-time during deployments or incidents.
File and Directory Operations
Creating and removing files/directories:
touch filename # Create empty file or update timestamp
mkdir -p /path/to/dir # Create directory (and parent dirs if needed)
rm filename # Delete file (DANGER: permanent!)
rm -r dirname # Delete directory and contents
rmdir dirname # Remove empty directory only
Copying and moving:
cp source.txt destination.txt # Copy file
cp -r source_dir dest_dir # Copy directory recursively
mv old_name new_name # Move or rename
mv -i old_name new_name # Interactive (asks before overwriting)
The -i flag is your safety net — always use it when moving production configuration files.
File Searching and Finding
find is powerful but verbose. Modern alternatives like fd are faster and more intuitive:
# Old way: find
find /path -name "*.log" # Find all .log files
find /path -type f -size +100M # Find files larger than 100MB
# Modern replacement: fd (faster, colored, regex by default)
fd "\.log$" /path # Find .log files
fd --size +100m /path # Files larger than 100MB
fd --follow # Follow symlinks
For rapid file searches in large source trees (like Kubernetes manifests or infrastructure-as-code repos), fd is significantly faster than find.
Permissions and Ownership
Understanding file permissions is essential for security and system stability:
chmod 755 script.sh # Owner: read/write/execute, Others: read/execute
chmod 644 config.yaml # Owner: read/write, Others: read-only
chmod u+x script.sh # Add execute permission for owner
chown user:group filename # Change owner and group
chown -R user:group dirname # Recursive ownership change
Permissions use three groups of three bits:
- Owner (u): user permissions
- Group (g): group permissions
- Other (o): everyone else permissions
Common DevOps values: 755 (executables), 644 (config files), 600 (secrets).
Searching Within Files
When you need to find specific content in files, grep and ripgrep (modern replacement) are essential:
# Old way: grep
grep "error" /var/log/app.log # Find lines containing "error"
grep -r "TODO" . # Recursively search all files
grep -i "Error" file.txt # Case-insensitive search
# Modern replacement: ripgrep (rg)
rg "error" /var/log/ # Faster recursive search
rg -g "*.yaml" "apiVersion" # Search only in YAML files
rg --type rust "TODO" # Search only in Rust files
Ripgrep (rg) is dramatically faster than grep on large codebases and automatically respects .gitignore patterns — perfect for searching infrastructure-as-code repos without hitting generated files.
systemd and Service Management
In modern Linux distributions, systemd manages services, and understanding systemctl and journalctl is critical for DevOps:
systemctl status nginx # Check if nginx is running
systemctl start nginx # Start service
systemctl stop nginx # Stop service
systemctl restart nginx # Restart service
systemctl enable nginx # Auto-start on boot
systemctl disable nginx # Don't auto-start on boot
systemctl list-units --type=service # List all services
journalctl -u nginx # Logs for nginx service only
journalctl -u nginx -f # Follow nginx logs
journalctl -u nginx --since "10 minutes ago" # Recent logs
journalctl -n 50 -u nginx # Last 50 lines
The journalctl command replaced traditional syslog for many systems. Using -u <service> to filter by unit name is far more efficient than grepping through /var/log/.
Container-Aware Commands
DevOps engineers frequently work inside containers and Kubernetes pods. Understanding namespace inspection is crucial:
# List all namespaces on system
lsns
# Inspect cgroups (Linux container boundaries)
cat /proc/cgroups
ps aux | grep containerid # Find container processes
# Mount inspection (important for volume debugging)
mount | grep -i docker # Show mounted volumes
df -h # Disk usage by mount point
For Kubernetes-specific Linux troubleshooting, see Part 2 (kubectl exec, docker exec, crictl).
WSL2 for Windows DevOps Engineers
If you're developing on Windows, WSL2 (Windows Subsystem for Linux 2) provides a full Linux kernel within Windows. This eliminates the need for virtual machines and provides native Linux development:
# On Windows PowerShell:
wsl --install # Install WSL2
wsl --list --verbose # List installed distributions
wsl -d Ubuntu # Run specific distribution
# From within WSL2:
/mnt/c/ # Access Windows C: drive
/mnt/d/ # Access Windows D: drive
WSL2 is the recommended Linux environment for Windows-based DevOps engineers in 2026, providing near-native performance for builds, tests, and local development.
Quick Reference Cheat Sheet
| Command | Purpose | Modern Alternative |
|---|---|---|
ls -la | List files with permissions | eza -la |
cat file | Display file contents | bat file |
find . -name | Search by filename | fd <pattern> |
grep -r pattern | Search file contents | rg pattern |
cd /path | Change directory | (no replacement needed) |
chmod 755 file | Change permissions | (no replacement needed) |
tail -f logfile | Monitor logs | (no replacement needed) |
systemctl restart svc | Restart service | (no replacement needed) |
Conclusion
These foundational commands form the backbone of Linux-based DevOps work. While modern tools like eza, bat, and ripgrep improve upon traditional commands with better output formatting and performance, the underlying concepts remain unchanged. Master these commands through regular use, and you'll navigate Linux systems with confidence. In Part 2, we'll build on this foundation with networking, process management, and container-specific debugging commands.