0% found this document useful (0 votes)
14 views6 pages

Linux Cheat Sheet

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views6 pages

Linux Cheat Sheet

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Linux Commands Cheat Sheet for DevOps

Linux Commands Cheat Sheet for DevOps

1. File & Directory Management


Command Use Case
ls List files in a directory
cd Change directory
pwd Print current working directory
mkdir Create a new directory
touch Create a new, empty file
cp Copy files or directories
mv Move or rename files
rm Remove files
rm -r Remove directories recursively
tree Show directory structure as a tree
find Search for files based on name, type, etc.
locate Fast file search using a database

2.File Viewing & Editing


Command Use Case
cat View file contents
less / View large files page by page
more
head Show first 10 lines of a file
tail Show last 10 lines of a file
tail -f Live-monitor logs or files
nano / vi / Edit files from the terminal
vim
Linux Commands Cheat Sheet for DevOps

3. Process Management
Command Use Case
ps Show running processes
top Dynamic real-time view of processes
htop Advanced version of top (interactive)
kill Kill a process by PID
killall Kill a process by name
nice / Change process priority
renice

4. User Management
Command Use Case
whoami Show current user
id Display UID, GID, and groups
adduser / Create new users
useradd
passwd Change a user's password
su Switch to another user
sudo Run command as superuser

5. Permissions & Ownership


Command Use Case
chmod Change file/folder permissions
chown Change file/folder ownership
umask Set default file permissions
ls -l View file permissions
Linux Commands Cheat Sheet for DevOps

6. Disk Usage
Command Use Case
df -h Show disk space usage in human-readable format
du -sh Show directory size
mount Mount a filesystem
umount Unmount a filesystem

7. Networking
Command Use Case
ip addr / ifconfig Show IP address and network interfaces
ping Test connectivity
netstat -tuln Show open ports and listening services
ss -tuln Faster version of netstat
curl Make HTTP requests
wget Download files via HTTP
traceroute Show the path packets take to a destination
nslookup Resolve domain names to IP
dig Detailed DNS lookup
hostname Show or set the hostname

8. Package Management
Command (Ubuntu/Debian) Use Case
apt update Update package list
apt upgrade Upgrade all packages
apt install <pkg> Install a package
apt remove <pkg> Remove a package
Command (RHEL/CentOS)
yum install <pkg> Install package
dnf install <pkg> Newer Fedora-based systems
Linux Commands Cheat Sheet for DevOps

9. Bash Scripting & Variables


Command Use Case
echo Print a message or variable
read Accept input from the user
export Set environment variables
#!/bin/bash Script shebang (interpreter path)
if, then, else Conditionals in bash
for, while Looping structures
function Define reusable blocks

10. System Services (Systemd)


Command Use Case
systemctl start Start a service
systemctl stop Stop a service
systemctl status Check status of a service
journalctl -u View logs for a systemd service

11. Compression & Archiving


Command Use Case
tar -czf Create a .tar.gz archive
tar -xzf Extract a .tar.gz archive
zip / unzip Compress/uncompress zip files
gzip / gunzip Compress/uncompress individual files
12. File Transfer & Sync
Command Use Case
scp Secure file copy to/from remote server
rsync Efficient sync between local/remote systems
ftp Connect to FTP server
sftp Secure FTP over SSH
Linux Commands Cheat Sheet for DevOps

Advanced Linux Commands


Command Description
strace Trace system calls and signals for a process
lsof List open files and the processes using them
nc (netcat) Check port connectivity and transfer data over
networks
xargs Build and execute command lines from standard
input
awk Process and extract data from structured text files
sed Edit text in files using patterns and replacements
watch Run a command repeatedly at fixed intervals
tmux Run multiple terminal sessions in one screen
iotop Monitor disk I/O usage per process
nmap Scan network for open ports and services
ufw Simplify firewall management on Ubuntu
sysctl View and modify kernel parameters at runtime
hostnamectl Set or view the system hostname
envsubst Substitute environment variables in template files
date --iso-8601 Display the date in ISO 8601 format
uptime Show system uptime and average load
crontab / at Schedule recurring or one-time jobs
ss Display active socket connections (faster than
netstat)
trap Define actions for shell script signals
ethtool Display or control Ethernet device settings

You might also like