Linux Commands Cheat Sheet
Quick Reference for Beginners
File and Directory Commands
- pwd - Print working directory
- ls - List directory contents
- cd [dir] - Change directory
- mkdir [dir] - Create directory
- rm [file] - Remove file
- rm -r [dir] - Remove directory recursively
- cp [src] [dest] - Copy file/directory
- mv [src] [dest] - Move/Rename file/directory
File Viewing and Editing
- cat [file] - View file content
- less [file] - View file content page by page
- head [file] - Show first 10 lines
- tail [file] - Show last 10 lines
- nano [file] - Edit file with nano editor
- vim [file] - Edit file with vim editor
System Information
- uname -a - System info
- df -h - Disk space usage
- free -m - Memory usage
- top - Running processes
- htop - Interactive process viewer
- whoami - Current logged in user
Permissions
- chmod [options] [file] - Change file permissions
- chown [user]:[group] [file] - Change ownership
- ls -l - Show file permissions
Networking
- ping [host] - Test connectivity
- ifconfig - Show IP addresses
- ip addr show - Display network interfaces
- curl [url] - Fetch data from URL
- wget [url] - Download file from URL
Package Management (Debian/Ubuntu)
- apt update - Refresh package index
- apt upgrade - Upgrade installed packages
- apt install [pkg] - Install package
- apt remove [pkg] - Remove package