$ ls index/

cheatsheets

Linux Commands Cheatsheet

$cat cheatsheets/linux.md

File System

pwd                          # Print working directory
ls                           # List directory contents
ls -l                        # Long format
ls -a                        # Include hidden files
ls -lh                       # Human-readable sizes
cd <dir>                     # Change directory
cd ..                        # Go up one directory
mkdir <dir>                  # Create directory
rmdir <dir>                  # Remove empty directory
rm <file>                    # Remove file
rm -rf <dir>                 # Remove directory recursively
touch <file>                 # Create empty file
cp <src> <dest>              # Copy file
cp -r <src> <dest>           # Copy directory recursively
mv <src> <dest>              # Move / rename
rm -f <file>                 # Force remove
ln -s <target> <link>        # Create symbolic link

File Viewing / Editing

cat <file>                   # View file contents
less <file>                  # View file page by page
head <file>                  # Show first 10 lines
head -5 <file>               # Show first 5 lines
tail <file>                  # Show last 10 lines
tail -f <file>               # Follow file changes in real-time
nano <file>                  # Edit file with nano
vim <file>                   # Edit file with vim
grep "pattern" <file>        # Search for pattern in file
grep -r "pattern" <dir>      # Recursive grep
wc <file>                    # Count lines, words, characters

File Permissions

chmod 755 <file>             # Change permissions (rwxr-xr-x)
chmod +x <file>              # Make file executable
chown user:group <file>      # Change file owner and group
chgrp group <file>           # Change file group

Process Management

ps                           # Show current processes
ps aux                       # Show all running processes
htop                         # Interactive process viewer (install first)
kill <pid>                   # Kill process by ID
kill -9 <pid>                # Force kill process
killall <name>               # Kill all processes by name
bg                           # List stopped/background jobs
fg                           # Bring most recent job to foreground
fg %<n>                      # Bring job n to foreground

System Information

uname                        # Show all system information
df                           # Show disk space (human-readable)
du <dir>                     # Show directory size
free                         # Show memory usage
lscpu                        # Show CPU information
lsblk                        # List block devices
uptime                       # Show uptime and load
whoami                       # Show current user
hostname                     # Show system hostname

Networking

ifconfig                     # Network interfaces (deprecated on some systems)
ip a                         # Show IP addresses
ping <host>                  # Ping host
traceroute <host>            # Trace route to host
netstat                      # Show listening ports and processes
ss                           # Modern alternative to netstat
wget <url>                   # Download file from URL
curl <url>                   # Fetch URL content
ssh user@host                # Connect to remote host via SSH
scp <file> user@host:path    # Copy file to remote host
rsync <src> <dest>           # Synchronize files/directories

Package Management

# Debian/Ubuntu (apt)
apt update                   # Update package list
apt upgrade                  # Upgrade installed packages
apt install <package>
apt remove <package>
apt search <term>

# RedHat/CentOS (dnf/yum)
dnf install <package>
dnf remove <package>
yum install <package>
yum remove <package>

# Arch Linux (pacman)
pacman -S <package>          # Install
pacman -R <package>          # Remove
pacman -Syu                  # Update system

User Management

sudo <command>               # Run command as superuser
su                           # Switch to root user
su <user>                    # Switch to specific user
useradd <user>               # Add new user
userdel <user>               # Delete user
passwd <user>                # Change user password
usermod -aG <group> <user>   # Add user to group
groups <user>                # Show user groups

Compression / Archiving

tar -cf archive.tar <dir>    # Create tar archive
tar -xf archive.tar          # Extract tar archive
tar -czf archive.tar.gz <dir> # Create gzipped tar archive
tar -xzf archive.tar.gz      # Extract gzipped tar archive
gzip <file>                  # Compress file
gunzip <file>.gz             # Decompress .gz file
zip archive.zip <file>       # Create zip archive
unzip archive.zip            # Extract zip archive

Miscellaneous

clear                        # Clear terminal screen
history                      # Show command history
!<n>                         # Repeat command from history number n
!!                           # Repeat last command
alias ll='ls -alf'           # Create command alias
crontab -e                   # Edit cron jobs
date                         # Show current date/time
cal                          # Show calendar
shutdown now                 # Shutdown system
reboot                       # Reboot system
exit                         # Exit shell

Tip: Use man <command> to view the manual page for any command.

Let's build something impactful together.

ertughaskan@gmail.com Find me online
Availability
WorkAvailable
RelocationOpen
FreelanceClosed
© 2026 Ertugrul Alex Haskan /cookiesVancouver, BC 🇨🇦

This site uses one optional Google Analytics cookie to see which pages get read. Nothing is set until you choose — cookie details.