Navigation
pwd # Print current directory
ls # List files
ls -la # List all files with details (including hidden)
cd dirname # Go into a directory
cd .. # Go up one level
cd ~ # Go to home directory
cd - # Go back to previous directory
Files & Directories
mkdir dirname # Create a directory
mkdir -p a/b/c # Create nested directories
touch file.txt # Create an empty file
cp file.txt copy.txt # Copy a file
cp -r dir/ newdir/ # Copy a directory
mv file.txt newname.txt # Rename or move a file
rm file.txt # Delete a file
rm -r dirname/ # Delete a directory and its contents
find . -name "*.txt" # Find files by name in current dir
Viewing Files
cat file.txt # Print file contents
less file.txt # Scroll through file (q to quit)
head -n 20 file.txt # Show first 20 lines
tail -n 20 file.txt # Show last 20 lines
tail -f file.txt # Follow file in real time (logs)
grep "word" file.txt # Search for text in a file
grep -r "word" ./ # Search recursively in directory
rg "word" ./ # Same but faster (ripgrep)
Permissions
ls -l # Show permissions for files
chmod +x script.sh # Make a file executable
chmod 644 file.txt # rw-r--r-- (owner rw, others r)
chmod 755 dirname/ # rwxr-xr-x (standard for dirs)
chown user:group file.txt # Change file owner
sudo command # Run command as root
sudo !! # Re-run last command as root
Package Management (pacman + yay)
sudo pacman -Syu # Update system
sudo pacman -S package # Install a package
sudo pacman -Rs package # Remove with dependencies
sudo pacman -Sc # Clean package cache
pacman -Ss keyword # Search packages
pacman -Q # List installed packages
pacman -Qi package # Show package details
sudo pacman -Rns $(pacman -Qdtq) # Remove orphaned packages
yay -Syu # Update everything (repos + AUR)
yay -S package # Install from AUR
yay -Ss keyword # Search repos + AUR
System Info
uname -r # Kernel version
uname -a # All system info
df -h # Disk usage (human readable)
free -h # RAM usage (human readable)
uptime # How long system has been running
lscpu # CPU info
cat /etc/os-release # Distro info
neofetch # System info with ASCII art
Processes
ps aux # List all running processes
htop # Interactive process viewer (q to quit)
kill PID # Kill process by ID
killall processname # Kill all processes by name
Ctrl + C # Stop running command
Ctrl + Z # Pause running command
bg # Resume paused command in background
fg # Bring background command to foreground
systemd Services
systemctl status service # Check service status
systemctl start service # Start a service
systemctl stop service # Stop a service
systemctl restart service # Restart a service
systemctl enable service # Auto-start on boot
systemctl disable service # Disable auto-start
systemctl list-units # List all active units
journalctl -u service # View service logs
journalctl -xe # View recent error logs
Networking
ip addr # Show IP addresses
ping google.com # Test connectivity
ping -c 4 google.com # Ping 4 times then stop
curl https://example.com # Fetch URL content
wget https://example.com/file.zip # Download a file
ssh user@host # Connect to remote server
nmcli device wifi list # List WiFi networks
nmcli device wifi connect "SSID" password "PWD" # Connect to WiFi
Archives
tar -czf archive.tar.gz dir/ # Create compressed archive
tar -xzf archive.tar.gz # Extract compressed archive
tar -tzf archive.tar.gz # List contents without extracting
zip -r archive.zip dir/ # Create zip archive
unzip archive.zip # Extract zip archive
Terminal Shortcuts
Tab # Autocomplete command or filename
Ctrl + R # Fuzzy search command history
!! # Repeat last command
history # Show command history
history | grep ssh # Search history for a command
Ctrl + L # Clear terminal (or type clear)
Ctrl + A # Jump to start of line
Ctrl + E # Jump to end of line
Ctrl + U # Delete from cursor to start of line
Ctrl + W # Delete previous word