A practical reference for the Linux commands you will use daily. Each section covers a focused set of operations with clear examples you can run immediately.

01 / Navigate Move around the filesystem

pwd, ls, cd — know where you are and what is there.

02 / Manage Files and directories

Create, copy, move, delete — the operations you repeat hundreds of times.

03 / Process Text and data

grep, sed, awk, sort, cut — filter, search, and transform content without leaving the terminal.

How to use this guide

Run each command in your terminal. Change one flag or argument at a time to see how the output changes. That small experiment is where syntax becomes muscle memory.

01 / Linux Core Directories

Understanding the filesystem layout is the first step to navigating Linux confidently. Every path starts from root (/).

Path Purpose Example
/ Root directory (everything starts here) /home, /etc
/bin Essential user binaries ls, cat
/usr User programs and libraries /usr/bin/python3
/etc System configuration files /etc/hosts
/home User home directories /home/alice
/root Root user’s home /root/.bashrc
/tmp Temporary files /tmp/mydata.txt
/var Variable data (logs, caches) /var/log/syslog
/dev Device files /dev/sda
/proc Virtual filesystem (kernel info) /proc/cpuinfo
/sys Hardware/system interface /sys/class/

02 / Navigation and Listing

pwd — print your current working directory
ls — list directory contents with flags for detail
cd — change directory using absolute or relative paths
pwd                     # Print Working Directory - where am I?
ls                      # List directory contents
ls -la                  # Long format, show hidden files, all files
ls -lt                  # Sort by modification time
ls /path/to/dir         # List contents of a specific directory
cd /home                # Change directory
cd ..                   # Go up one level
cd ~                    # Go to home directory
cd -                    # Go back to previous directory

03 / File Operations

mkdir -p — create directories recursively
cp -r — copy directories with all contents
rm -rf — force remove (use with caution)
mkdir -p ~/newdir/subdir  # Create directory (recursive)
rmdir emptydir           # Remove empty directory
cp file1 file2           # Copy file
cp -r dir1 dir2          # Copy directory (recursive)
mv file1 file2           # Move/Rename file
rm file                  # Remove file
rm -rf dirname           # Force remove directory
touch filename           # Create empty file

04 / File Viewing and Editing

cat — dump entire file to terminal
head / tail — view start or end of files, tail -f for live logs
less — page through large files without loading everything into memory
cat file                 # Display file contents
head file                # Show first 10 lines
head -n 20 file          # Show first 20 lines
tail file                # Show last 10 lines
tail -f logfile          # Follow log file in real-time
less file                # Page through file
nano file                # Simple text editor
vim file                 # Full-featured text editor

05 / Text Processing

grep — search for patterns in files (supports regex)
sed — stream editor for find-and-replace operations
awk — column-based text processing and reporting
grep "pattern" file        # Search for text in files
grep -r "pattern" dir      # Recursive search through directory
grep -i "pattern" file     # Case insensitive
grep -n "pattern" file     # Show line numbers
grep -c "pattern" file     # Count matches
sed 's/old/new/g' file    # Stream editor (replace text)
sed -n '5,10p' file       # Print lines 5 through 10
awk '{print $1}' file     # Print first column
awk -F',' '{print $2}' file  # Print second field (comma delimiter)
cut -d',' -f1 file        # Cut specific field
sort file                 # Sort lines
sort -u file              # Sort and remove duplicates
uniq file                 # Remove consecutive duplicate lines
wc -l file                # Count lines
wc -w file                # Count words

06 / File Permissions

rwx — read, write, execute for owner, group, and others
chmod — change permissions with symbolic or numeric mode
chown — change file ownership
ls -la                    # View permissions (rwxr-xr-x format)
chmod 755 script.sh       # rwxr-xr-x (owner: full, others: read+execute)
chmod +x script.sh        # Add execute permission
chmod -R 644 directory    # Recursive permission change
chown user:group file     # Change owner and group
chown -R user:group dir   # Recursive ownership change

Permission Numeric Reference

Number Permission Meaning
7 rwx Read + Write + Execute
6 rw- Read + Write
5 r-x Read + Execute
4 r– Read only
0 No permissions

07 / Process Management

ps — snapshot of current processes
top / htop — real-time process monitoring
kill — send signals to terminate or control processes
ps aux                    # List all running processes
ps aux | grep python      # Filter processes by name
top                       # Interactive process viewer
htop                      # Enhanced process viewer (if installed)
kill PID                  # Terminate process by PID
kill -9 PID               # Force kill (SIGKILL)
kill -STOP PID            # Pause process
kill -CONT PID            # Resume process
bg                        # Resume stopped process in background
fg                        # Bring background process to foreground
jobs                      # List background jobs

08 / System Information

uname — kernel and system details
free — memory usage at a glance
df — disk space on mounted filesystems
uname -a                 # Kernel version and architecture
uname -r                 # Kernel release only
whoami                   # Current logged-in user
hostname                 # System hostname
date                     # Current date and time
uptime                   # System uptime and load averages
free -h                  # Human-readable memory usage
df -h                    # Disk space usage (human-readable)
du -sh /path/to/dir      # Directory size summary
lsb_release -a           # Linux distribution info

09 / Package Management

apt — Debian/Ubuntu package manager
dnf — Fedora/RHEL package manager
Always update the package index before installing new software.

APT (Debian/Ubuntu)

sudo apt update                    # Refresh package index
sudo apt upgrade -y                # Upgrade all installed packages
sudo apt install -y package_name   # Install a package
sudo apt remove -y package_name    # Remove a package
sudo apt search keyword            # Search for packages
sudo apt show package_name         # Show package details
sudo apt list --installed          # List installed packages

DNF (Fedora/RHEL)

sudo dnf update                    # Update all packages
sudo dnf install -y package_name   # Install a package
sudo dnf remove package_name       # Remove a package
sudo dnf search keyword            # Search for packages
sudo dnf info package_name         # Show package details
sudo dnf list installed            # List installed packages

10 / Networking

ip / ifconfig — view and configure network interfaces
ping — test connectivity to a host
ss — inspect active sockets and connections
ip addr show             # Display all network interfaces
ip route show            # Display routing table
ping google.com          # Test connectivity (Ctrl+C to stop)
ping -c 4 google.com     # Send exactly 4 packets
curl https://example.com # Fetch URL content
wget https://example.com/file  # Download a file
ss -tulnp                # Show listening TCP/UDP ports
netstat -tulnp           # Alternative port listing
ssh user@host            # Secure shell login
scp file user@host:/path # Secure copy to remote host

11 / Searching Files

find — locate files by name, size, time, or type
which — find the path of an executable
locate — fast file search using a prebuilt index
find /path -name "*.txt"           # Find files by name
find . -type f -size +100M         # Find files larger than 100MB
find . -mtime -7                   # Files modified in last 7 days
find . -empty                      # Find empty files/directories
find . -name "*.log" -delete       # Find and delete all .log files
which python3                      # Path to executable
locate filename                    # Fast index-based search

12 / Summary

Category Key Commands
Navigation pwd, ls -la, cd
Files mkdir -p, cp -r, mv, rm -rf, touch
Viewing cat, head, tail -f, less
Text Processing grep -r, sed, awk, sort, wc
Permissions chmod, chown
Processes ps aux, top, kill, jobs
System Info uname -a, free -h, df -h
Packages apt update/install, dnf install
Networking ip addr, ping, ss -tulnp, ssh
Searching find, which, locate