The Linux Power User Handbook: From Daily Driver to Productivity Machine

Your complete reference guide for mastering Linux productivity, shortcuts, hidden features, and advanced workflows

1️⃣ Day-to-Day Survival Kit
🌅 Morning Routine: First 5 Minutes
Quick System Health Check
# The Ultimate Morning One-Liner
uptime && df -h / && free -h && sensors | grep temp
# What you get:
# - System uptime
# - Disk space usage
# - RAM status
# - CPU temperature
Update Everything in One Command
# Ubuntu/Debian
sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y && flatpak update -y && snap refresh
# Arch-based
yay -Syu --noconfirm
# Create an alias for this:
echo "alias update-all='sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y && flatpak update -y && snap refresh'" >> ~/.bashrc
Launch Your Work Environment Instantly
# Create a startup script
nano ~/startup.sh
# Add your apps:
#!/bin/bash
firefox &
code ~/projects &
spotify &
slack &
# Make it executable
chmod +x ~/startup.sh
# Run it
./startup.sh
📁 Essential File Operations
Copy with Progress Bar (never wonder if it's frozen again)
# Install rsync if not available
sudo apt install rsync
# Copy with progress
rsync -ah --progress source_folder/ destination_folder/
# Want even better? Use 'pv'
sudo apt install pv
tar czf - large_folder | pv > backup.tar.gz
Find Files Lightning Fast
# Find by name (case-insensitive)
find ~ -iname "*document*"
# Find files modified in last 7 days
find ~ -type f -mtime -7
# Find large files (over 100MB)
find ~ -type f -size +100M
# The BETTER way - use 'fd' (faster than find)
sudo apt install fd-find
fd document # Simple and fast
fd -e pdf # Find all PDFs
fd -t f -s '>100M' # Files larger than 100MB
Search Inside Files
# Basic grep
grep -r "search_term" /path/to/directory
# Better with colors and line numbers
grep -rn --color=auto "search_term" /path
# The BEST way - use 'ripgrep' (30x faster)
sudo apt install ripgrep
rg "search_term" # Automatic .gitignore respect
rg -i "case_insensitive" # Case insensitive
rg -t py "import" # Only in Python files
🔥 Quick Fixes for Common Problems
WiFi Acting Up?
# Quick restart network
sudo systemctl restart NetworkManager
# Or nuclear option
sudo nmcli radio wifi off && sleep 2 && sudo nmcli radio wifi on
System Sluggish?
# Clear memory cache (safe)
sync; echo 3 | sudo tee /proc/sys/vm/drop_caches
# Find memory hogs
ps aux --sort=-%mem | head -10
# Find CPU hogs
ps aux --sort=-%cpu | head -10
# Interactive way
htop # or install with: sudo apt install htop
Disk Full?
# Find what's eating your space
du -sh ~/* | sort -hr | head -10
# Better visualization with ncdu
sudo apt install ncdu
ncdu ~ # Interactive disk usage explorer

🖥️ GNOME Desktop (Ubuntu Default)
System Navigation
| Shortcut | Action | Power User Tip |
Super | Activities overview | Your command center - use it! |
Super + A | Show applications | Faster than clicking |
Super + V | Show notification list | Check messages without leaving work |
Alt + Tab | Switch windows | Hold Alt, press Tab multiple times |
| `Alt + `` | Switch between windows of same app | Game changer for developers |
Super + Tab | Switch applications | Different from Alt+Tab |
Super + PgUp/PgDn | Switch workspaces | Multi-desktop mastery |
Ctrl + Alt + Up/Down | Move between workspaces | Alternative method |
Window Management
| Shortcut | Action | Why It's Awesome |
Super + Left/Right | Snap window to side | Instant 50/50 split |
Super + Up | Maximize window | One key, full screen |
Super + Down | Restore/minimize | Undo maximize |
Super + H | Hide window | Clean desk, focused mind |
Alt + F4 | Close window | Classic but essential |
Alt + F8 | Resize window with keyboard | Mouse-free window sizing |
Alt + F10 | Maximize/restore | Toggle maximize |
Alt + Space | Window menu | Access all window options |
Application Shortcuts
| Shortcut | Action | Customization Tip |
Super + 1-9 | Open favorite app (by position) | Arrange your dock strategically |
Ctrl + Alt + T | Open terminal | Most used shortcut ever |
Super + L | Lock screen | Leaving desk? Lock it! |
Alt + F2 | Run command dialog | Quick app launcher |
Ctrl + Alt + Del | Power off menu | Windows muscle memory works |
⌨️ Terminal Shortcuts (Bash)
These will change your life
Navigation
| Shortcut | Action | Example |
Ctrl + A | Jump to line start | Instead of holding ← |
Ctrl + E | Jump to line end | Instead of holding → |
Ctrl + U | Delete from cursor to start | Quick line clear |
Ctrl + K | Delete from cursor to end | Erase the rest |
Ctrl + W | Delete word before cursor | Word-by-word deletion |
Alt + B | Move backward one word | Skip words, not letters |
Alt + F | Move forward one word | Speed navigation |
Ctrl + XX | Toggle between line start and cursor | Genius trick |
History & Search
| Shortcut | Action | Power User Secret |
Ctrl + R | Reverse search history | MOST IMPORTANT SHORTCUT |
Ctrl + G | Exit search | Escape from Ctrl+R |
Ctrl + P | Previous command | Alternative to ↑ |
Ctrl + N | Next command | Alternative to ↓ |
!! | Repeat last command | Type this literally |
!$ | Last argument of previous command | Saves so much typing |
!* | All arguments of previous command | Copy all args |
!xyz | Run last command starting with "xyz" | !git runs last git command |
Process Control
| Shortcut | Action | When to Use |
Ctrl + C | Kill current process | Stuck command? Kill it |
Ctrl + Z | Suspend current process | Pause, don't kill |
Ctrl + D | Exit terminal/EOF | Clean exit |
Ctrl + L | Clear screen | Keep history, clean view |
Advanced Tricks
# Use Ctrl+R to search history
# Press Ctrl+R, type "git", it finds "git commit -m 'fix bug'"
# Press Enter to execute, or Right arrow to edit first
# Use !$ to reuse last argument
mkdir /var/www/myproject
cd !$ # Automatically becomes: cd /var/www/myproject
# Use !! to fix forgotten sudo
apt update
# "Permission denied"
sudo !! # Becomes: sudo apt update
📝 VS Code Shortcuts for Linux
| Shortcut | Action | Why You Need It |
Ctrl + P | Quick file open | Faster than file explorer |
Ctrl + Shift + P | Command palette | Access everything |
Ctrl + B | Toggle sidebar | More screen space |
| `Ctrl + `` | Toggle terminal | Coding + terminal in one |
Alt + Up/Down | Move line up/down | Reorder code instantly |
Ctrl + D | Multi-cursor on next match | Edit multiple at once |
Ctrl + / | Toggle line comment | Quick commenting |
Ctrl + Shift + K | Delete line | No selection needed |
Ctrl + Shift + F | Search in files | Project-wide search |
F2 | Rename symbol | Refactor safely |
🌐 Firefox Shortcuts (Linux-specific)
| Shortcut | Action | Pro Tip |
Ctrl + T | New tab | Basic but essential |
Ctrl + Shift + T | Reopen closed tab | Saved my life 1000 times |
Ctrl + L | Focus address bar | Type URL immediately |
Ctrl + K | Focus search bar | Quick search |
Ctrl + Tab | Next tab | Cycle through tabs |
Ctrl + 1-8 | Jump to tab number | Go to specific tab |
Ctrl + 9 | Last tab | Skip to end |
Alt + Left/Right | Back/forward | History navigation |
F6 | Cycle through frames | Web dev trick |
3️⃣ Terminal Mastery: Beyond Basic Commands

🎯 The Commands That Separate Beginners from Power Users
tmux - Terminal Multiplexer (Life-Changing)
Why You Need It: One terminal, infinite possibilities. Split panes, multiple windows, session persistence.
# Install
sudo apt install tmux
# Basic usage
tmux # Start new session
tmux new -s mysession # Named session
tmux attach -t mysession # Reattach to session
tmux ls # List sessions
# Inside tmux (Ctrl+B then):
# Split horizontally: Ctrl+B then "
# Split vertically: Ctrl+B then %
# Navigate panes: Ctrl+B then arrow keys
# New window: Ctrl+B then c
# Switch windows: Ctrl+B then 0-9
# Detach: Ctrl+B then d
Real-World Scenario:
# SSH into server
ssh user@server
# Start tmux session for long-running task
tmux new -s deployment
# Run deployment (takes 2 hours)
./deploy_to_production.sh
# Detach (Ctrl+B then d) - close laptop, go home
# Later, SSH back in
tmux attach -t deployment
# Your deployment is still running!
fzf - Fuzzy Finder (Will Blow Your Mind)
The Game Changer: Interactive fuzzy search for EVERYTHING.
# Install
sudo apt install fzf
# Basic fuzzy find
fzf
# Search command history
history | fzf
# Search and cd into directory
cd $(find ~ -type d | fzf)
# Search and edit file
vim $(fzf)
# Add to .bashrc for Ctrl+R superpower
echo 'source /usr/share/doc/fzf/examples/key-bindings.bash' >> ~/.bashrc
# Now Ctrl+R uses fzf instead!
Power User Setup:
# Add these to ~/.bashrc
export FZF_DEFAULT_OPTS='--height 40% --layout=reverse --border'
# Search and kill process
alias killit='kill $(ps aux | fzf | awk "{print \$2}")'
# Quick git commit browser
alias glog='git log --oneline --color | fzf --ansi'
ag (The Silver Searcher) - Grep on Steroids
# Install
sudo apt install silversearcher-ag
# Search in current directory (ignores .gitignore)
ag "search_term"
# Case insensitive
ag -i "search_term"
# Only show filenames
ag -l "search_term"
# Search in specific file types
ag --python "search_term"
bat - Better cat
# Install
sudo apt install bat
# On Ubuntu it's called 'batcat' due to name conflict
batcat filename.py
# Syntax highlighting, line numbers, git integration!
# Make it default cat
echo "alias cat='batcat'" >> ~/.bashrc
exa - Better ls
# Install
sudo apt install exa
# Better ls with colors and icons
exa -la
# Tree view with icons
exa --tree --level=2 --icons
# Git status in listings
exa -la --git
# Make it default
echo "alias ls='exa --icons'" >> ~/.bashrc
echo "alias ll='exa -la --icons --git'" >> ~/.bashrc
🔄 Command Chaining & Piping Mastery
# Run commands sequentially (always)
command1 ; command2 ; command3
# Run only if previous succeeds (AND)
command1 && command2 && command3
# Run only if previous fails (OR)
command1 || command2
# Pipe output to next command
ps aux | grep firefox | awk '{print $2}' | xargs kill
# Redirect output to file
ls -la > file_list.txt # Overwrite
ls -la >> file_list.txt # Append
# Redirect errors
command 2> errors.log # Only errors
command > output.log 2>&1 # Both output and errors
# Discard output
command > /dev/null 2>&1 # Send to void
🧰 One-Liners That Look Like Magic
# Find and replace in multiple files
find . -type f -name "*.txt" -exec sed -i 's/old/new/g' {} +
# Download entire website
wget -r -p -k -E https://example.com
# Monitor file changes in real-time
watch -n 1 'ls -lh /path/to/file'
# Create directory and cd into it in one command
mkcd() { mkdir -p "$1" && cd "$1"; }
# Extract any archive
extract() {
if [ -f $1 ]; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar e $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z x $1 ;;
*) echo "'$1' cannot be extracted via extract()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
# Quick web server in current directory
python3 -m http.server 8000
# Generate random password
openssl rand -base64 32
# Monitor bandwidth usage
sudo apt install nethogs
sudo nethogs
# JSON pretty-print
cat data.json | python3 -m json.tool
# Quickly backup a file
cp file.txt{,.bak} # Creates file.txt.bak
# Create multiple directories
mkdir -p project/{src,tests,docs,config}
4️⃣ Hidden Features You Never Knew Existed

🎨 GNOME Shell Extensions (Supercharge Your Desktop)
Must-Have Extensions:
Dash to Panel - Windows-like taskbar
# Install from: extensions.gnome.org/extension/1160/dash-to-panel/Clipboard Indicator - Clipboard history manager
# Install from: extensions.gnome.org/extension/779/clipboard-indicator/ # Access: Click indicator icon or Super+Shift+VGSConnect - Android phone integration
sudo apt install gnome-shell-extension-gsconnect # Features: # - Share files between phone and PC # - Reply to texts from computer # - Mouse/keyboard remote control # - Clipboard syncVitals - System monitor in top bar
# Shows: CPU, RAM, temp, network speed in real-timeCaffeine - Prevent screen from sleeping
# Toggle on when watching videos or presenting
Install Extensions via Terminal:
# Install extension manager
sudo apt install gnome-shell-extension-manager
# Or use browser:
# 1. Install browser extension
# 2. Visit extensions.gnome.org
# 3. Toggle ON
🔍 Hidden System Commands
systemd Secrets
# List all services
systemctl list-units --type=service
# Services that failed to start
systemctl --failed
# Boot time analysis
systemd-analyze # Total boot time
systemd-analyze blame # Services by time
systemd-analyze critical-chain # Boot bottlenecks
# Create custom service
sudo nano /etc/systemd/system/myapp.service
[Unit]
Description=My Application
After=network.target
[Service]
Type=simple
User=youruser
ExecStart=/path/to/your/app
Restart=always
[Install]
WantedBy=multi-user.target
# Enable and start
sudo systemctl daemon-reload
sudo systemctl enable myapp.service
sudo systemctl start myapp.service
Hidden .bashrc Powers
# Edit your .bashrc
nano ~/.bashrc
# Add these gems:
# Better history
export HISTSIZE=10000
export HISTFILESIZE=20000
export HISTCONTROL=ignoreboth:erasedups
shopt -s histappend
# Instant typo correction
shopt -s cdspell
# Case-insensitive tab completion
bind "set completion-ignore-case on"
# Show all completions immediately
bind "set show-all-if-ambiguous on"
# Color prompt with git branch
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
export PS1="\[\e[32m\]\u@\h\[\e[m\]:\[\e[34m\]\w\[\e[m\]\[\e[33m\]\$(parse_git_branch)\[\e[m\]$ "
# Ultimate aliases
alias c='clear'
alias h='history'
alias ports='netstat -tulanp'
alias meminfo='free -m -l -t'
alias psmem='ps auxf | sort -nr -k 4'
alias pscpu='ps auxf | sort -nr -k 3'
alias update='sudo apt update && sudo apt upgrade -y'
alias install='sudo apt install'
alias remove='sudo apt remove'
# Git shortcuts
alias gs='git status'
alias ga='git add'
alias gc='git commit -m'
alias gp='git push'
alias gl='git log --oneline --graph --all --decorate'
# Navigation shortcuts
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias dl='cd ~/Downloads'
alias doc='cd ~/Documents'
alias dev='cd ~/Development'
# Safety nets
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
# Quick edits
alias bashrc='nano ~/.bashrc && source ~/.bashrc'
# Reload .bashrc
source ~/.bashrc
🎭 Hidden Desktop Features
Virtual Desktops on Steroids
# Install workspace matrix extension
# Gives you a grid of workspaces (e.g., 3x3 = 9 workspaces!)
# Or use built-in dynamic workspaces more effectively:
# Settings → Multitasking → Workspaces → Fixed number
# Set to 6-9 workspaces
# Organize by task:
# Workspace 1: Browsers
# Workspace 2: Code editors
# Workspace 3: Terminal windows
# Workspace 4: Communication (Slack, Discord)
# Workspace 5: Media (Spotify, Videos)
# Workspace 6: Documentation
Window Rules & Automation
# Install devilspie2 for advanced window rules
sudo apt install devilspie2
mkdir -p ~/.config/devilspie2
nano ~/.config/devilspie2/spotify.lua
-- Always open Spotify on workspace 5
if (get_application_name() == "Spotify") then
set_workspace(5)
maximize()
end
# Auto-start devilspie2
echo "devilspie2" >> ~/.config/autostart/devilspie2.desktop
Quick Note-Taking from Anywhere
# Install xpad (sticky notes)
sudo apt install xpad
# Keyboard shortcut setup:
# Settings → Keyboard → Custom Shortcuts
# Command: xpad
# Shortcut: Super+N
# Now Super+N = instant note taking!
5️⃣ Productivity Hacks That Save Hours

⚡ Text Expansion (Type Less, Do More)
Espanso - Universal Text Expander
# Install
wget https://github.com/federico-terzi/espanso/releases/latest/download/espanso-debian-amd64.deb
sudo dpkg -i espanso-debian-amd64.deb
# Register and start
espanso service register
espanso start
# Create shortcuts
espanso edit
# Add these:
matches:
- trigger: ":email"
replace: "your.email@example.com"
- trigger: ":phone"
replace: "+1 234-567-8900"
- trigger: ":addr"
replace: "123 Main St, City, Country"
- trigger: ":shrug"
replace: "¯\\_(ツ)_/¯"
- trigger: ":sign"
replace: |
Best regards,
Your Name
Your Title
Company Name
- trigger: ":lorem"
replace: "Lorem ipsum dolor sit amet, consectetur adipiscing elit..."
- trigger: ":date"
replace: "{{mydate}}"
vars:
- name: mydate
type: date
params:
format: "%Y-%m-%d"
# Now typing :email anywhere will expand to your email!
🔄 Clipboard Manager (Never Lose Anything)
# Install CopyQ
sudo apt install copyq
# Start with system
copyq # Runs in background
# Use: Ctrl+Shift+V to show history
# Or click system tray icon
# Keeps 200+ clipboard items
# Search through history
# Create permanent clips
# Edit before pasting
🖼️ Screenshot Tools (Beyond Print Screen)
Flameshot - Professional Screenshots
# Install
sudo apt install flameshot
# Set keyboard shortcut
# Settings → Keyboard → Custom Shortcuts
# Name: Screenshot
# Command: flameshot gui
# Shortcut: Print Screen
# Features:
# - Draw arrows, circles, text
# - Blur sensitive info
# - Immediate upload options
# - Blur faces
# - Copy to clipboard
# - Save to file
📋 Task Management from Terminal
Taskwarrior - TODO List That Doesn't Suck
# Install
sudo apt install taskwarrior
# Basic usage
task add "Write blog post" # Add task
task add "Deploy website" due:tomorrow # With due date
task add "Fix bug" priority:H project:webapp # With priority
# List tasks
task list # Active tasks
task next # What to do next
task overdue # Oh no...
# Complete task
task 1 done
# Modify task
task 1 modify priority:H
# Start working on task (tracks time)
task 1 start
# Export to JSON
task export
# Sync with phone (Taskwarrior has apps!)
🎯 Focus Mode (Block Distractions)
Cold Turkey Alternative for Linux
# Install LeechBlock NG browser extension
# Or use hosts file method:
sudo nano /etc/hosts
# Add at the end:
127.0.0.1 facebook.com
127.0.0.1 www.facebook.com
127.0.0.1 twitter.com
127.0.0.1 www.twitter.com
127.0.0.1 reddit.com
127.0.0.1 www.reddit.com
# Save and activate
sudo systemctl restart NetworkManager
# Create script to toggle
nano ~/toggle-focus.sh
#!/bin/bash
if grep -q "# FOCUS MODE" /etc/hosts; then
sudo sed -i '/# FOCUS MODE/,/# END FOCUS MODE/d' /etc/hosts
echo "Focus mode OFF - Distractions enabled"
else
echo "# FOCUS MODE" | sudo tee -a /etc/hosts
echo "127.0.0.1 facebook.com" | sudo tee -a /etc/hosts
echo "127.0.0.1 www.facebook.com" | sudo tee -a /etc/hosts
echo "127.0.0.1 twitter.com" | sudo tee -a /etc/hosts
echo "127.0.0.1 reddit.com" | sudo tee -a /etc/hosts
echo "# END FOCUS MODE" | sudo tee -a /etc/hosts
echo "Focus mode ON - Stay focused!"
fi
sudo systemctl restart NetworkManager
chmod +x ~/toggle-focus.sh
🤖 Automation with Cron Jobs
# Edit crontab
crontab -e
# Syntax: minute hour day month weekday command
# Examples:
# Backup every day at 2 AM
0 2 * * * /home/user/backup-script.sh
# Clear Downloads folder every Sunday at midnight
0 0 * * 0 rm -rf ~/Downloads/*
# System update every Monday at 3 AM
0 3 * * 1 sudo apt update && sudo apt upgrade -y
# Remind to take break every hour
0 * * * * notify-send "Break Time!" "Look away from screen for 5 minutes"
# Git auto-commit notes every 30 minutes
*/30 * * * * cd ~/notes && git add . && git commit -m "Auto-save $(date)" && git push
# Check website uptime every 5 minutes
*/5 * * * * curl -Is https://yoursite.com | head -n 1 >> ~/uptime.log
# Quick reference:
# */5 * * * * Every 5 minutes
# 0 */2 * * * Every 2 hours
# 0 9-17 * * * Every hour from 9 AM to 5 PM
# 0 0 * * MON Every Monday at midnight
6️⃣ Advanced Workflow Optimization

🎮 Window Manager Power Moves
i3 Window Manager (For Ultimate Control)
Optional but life-changing for power users
# Install
sudo apt install i3
# Basic config location: ~/.config/i3/config
# Key concepts:
# - Windows tile automatically
# - No overlapping windows
# - 100% keyboard-driven
# - Instant window switching
# Example workflow:
# Mod+Enter: Open terminal
# Mod+d: Launch app
# Mod+1-9: Switch workspace
# Mod+Shift+1-9: Move window to workspace
# Mod+h/j/k/l: Navigate windows (Vim-style)
# Mod+r: Resize mode
📊 Monitoring & Logging
System Monitoring Setup
# Install monitoring tools
sudo apt install htop btop iotop nethogs
# htop - Interactive process viewer
htop
# btop - Beautiful resource monitor (modern htop)
btop
# iotop - I/O usage by process
sudo iotop
# nethogs - Network usage by process
sudo nethogs
# Create monitoring dashboard
# Install glances (all-in-one)
sudo apt install glances
glances # Web interface: localhost:61208
Log Management
# View system logs
journalctl -xe # Recent logs with explanation
journalctl -f # Follow logs (like tail -f)
journalctl -u servicename # Specific service logs
journalctl --since "1 hour ago" # Time-filtered logs
journalctl -p err # Only errors
# Analyze log sizes
sudo journalctl --disk-usage
# Clear old logs
sudo journalctl --vacuum-time=7d # Keep 7 days
sudo journalctl --vacuum-size=500M # Keep 500MB max
🐳 Docker Productivity (For Developers)
# Useful aliases for ~/.bashrc
alias dps='docker ps'
alias dpsa='docker ps -a'
alias di='docker images'
alias drm='docker rm $(docker ps -aq)'
alias drmi='docker rmi $(docker images -q)'
alias dstop='docker stop $(docker ps -aq)'
# Docker cleanup
docker system prune -af --volumes # Nuclear cleanup
# Quick containers
alias nginx='docker run -d -p 8080:80 nginx'
alias postgres='docker run -d -e POSTGRES_PASSWORD=password -p 5432:5432 postgres'
alias redis='docker run -d -p 6379:6379 redis'
# Docker compose shortcuts
alias dc='docker-compose'
alias dcu='docker-compose up -d'
alias dcd='docker-compose down'
alias dcl='docker-compose logs -f'
🔐 SSH & Remote Work Mastery
SSH Config File (Stop Typing Long Commands)
nano ~/.ssh/config
# Add your servers:
Host myserver
HostName 192.168.1.100
User admin
Port 2222
IdentityFile ~/.ssh/id_rsa_myserver
Host github
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_github
Host aws-prod
HostName ec2-xx-xx-xx-xx.compute.amazonaws.com
User ubuntu
IdentityFile ~/.ssh/aws-key.pem
# Now just type:
ssh myserver # Instead of: ssh admin@192.168.1.100 -p 2222 -i ~/.ssh/id_rsa_myserver
SSH Tunneling & Port Forwarding
# Local port forwarding (access remote service locally)
ssh -L 8080:localhost:80 user@remote-server
# Now localhost:8080 accesses remote server's port 80
# Remote port forwarding (expose local service remotely)
ssh -R 9000:localhost:3000 user@remote-server
# Remote server's port 9000 accesses your localhost:3000
# Dynamic port forwarding (SOCKS proxy)
ssh -D 8080 user@remote-server
# Use localhost:8080 as SOCKS proxy in browser
# Keep SSH connection alive
nano ~/.ssh/config
# Add:
ServerAliveInterval 60
ServerAliveCountMax 3
SSH Keys Management
# Generate new key
ssh-keygen -t ed25519 -C "your_email@example.com"
# Copy to server (easy way)
ssh-copy-id user@server
# Manual way
cat ~/.ssh/id_ed25519.pub | ssh user@server "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"
# Use ssh-agent to avoid repeated password entry
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
# Auto-start ssh-agent in .bashrc
if [ -z "$SSH_AUTH_SOCK" ]; then
eval "$(ssh-agent -s)" > /dev/null
ssh-add ~/.ssh/id_ed25519 2>/dev/null
fi
7️⃣ System Administration Secrets

🔧 System Performance Tuning
Swap Management
# Check current swap
free -h
swapon --show
# Adjust swappiness (how aggressively to use swap)
# Default is 60, lower = less swap usage
sudo sysctl vm.swappiness=10
# Make permanent
echo "vm.swappiness=10" | sudo tee -a /etc/sysctl.conf
# Create swap file if needed
sudo fallocate -l 4G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
# Make permanent
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
I/O Scheduler Optimization
# Check current scheduler
cat /sys/block/sda/queue/scheduler
# For SSD (use deadline or noop)
echo deadline | sudo tee /sys/block/sda/queue/scheduler
# For HDD (use cfq or bfq)
echo bfq | sudo tee /sys/block/sda/queue/scheduler
# Make permanent
sudo nano /etc/udev/rules.d/60-scheduler.rules
# Add:
ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/scheduler}="deadline"
Disable Unnecessary Services
# List all services
systemctl list-unit-files --type=service
# Disable Bluetooth if not needed
sudo systemctl disable bluetooth.service
# Disable printer service if no printer
sudo systemctl disable cups.service
# Check what's slowing boot
systemd-analyze blame | head -20
📦 Package Management Pro Tips
APT Advanced Usage
# Show package info
apt show package-name
# Search for packages
apt search keyword
# List installed packages
apt list --installed
# Check which package owns a file
dpkg -S /usr/bin/firefox
# Find which package provides a file
apt-file search filename
# Hold package version (prevent updates)
sudo apt-mark hold package-name
# Unhold
sudo apt-mark unhold package-name
# Reinstall package (fix corrupted installs)
sudo apt install --reinstall package-name
# Download package without installing
apt download package-name
# Extract .deb without installing
dpkg-deb -x package.deb /output/directory
PPA Management
# Add PPA
sudo add-apt-repository ppa:owner/ppa-name
# Remove PPA
sudo add-apt-repository --remove ppa:owner/ppa-name
# List all PPAs
grep -r --include '*.list' '^deb ' /etc/apt/sources.list /etc/apt/sources.list.d/
# Clean up broken PPAs
sudo apt-add-repository --remove ppa:broken/ppa
sudo apt update
Flatpak & Snap Management
# Flatpak commands
flatpak list # List installed
flatpak search app-name # Search
flatpak install app-name # Install
flatpak update # Update all
flatpak remove app-name # Remove
flatpak run app-name # Run
# Snap commands
snap list # List installed
snap find app-name # Search
snap install app-name # Install
snap refresh # Update all
snap remove app-name # Remove
# Remove old snap versions (saves space)
sudo snap set system refresh.retain=2
🛡️ Security Hardening
Firewall Setup (UFW)
# Install and enable
sudo apt install ufw
sudo ufw enable
# Default policies
sudo ufw default deny incoming
sudo ufw default allow outgoing
# Allow specific services
sudo ufw allow ssh # Port 22
sudo ufw allow 80/tcp # HTTP
sudo ufw allow 443/tcp # HTTPS
sudo ufw allow 8080:8090/tcp # Port range
# Allow from specific IP
sudo ufw allow from 192.168.1.100
# Check status
sudo ufw status verbose
# Delete rule
sudo ufw delete allow 8080/tcp
Fail2Ban (Brute Force Protection)
# Install
sudo apt install fail2ban
# Copy default config
sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
# Edit config
sudo nano /etc/fail2ban/jail.local
# Key settings:
[sshd]
enabled = true
port = ssh
maxretry = 3 # Ban after 3 failed attempts
bantime = 3600 # Ban for 1 hour
# Start service
sudo systemctl enable fail2ban
sudo systemctl start fail2ban
# Check banned IPs
sudo fail2ban-client status sshd
# Unban IP
sudo fail2ban-client set sshd unbanip 192.168.1.100
System Auditing
# Install audit framework
sudo apt install auditd
# Monitor file access
sudo auditctl -w /etc/passwd -p wa -k passwd_changes
# Monitor command execution
sudo auditctl -a always,exit -F arch=b64 -S execve -k command_exec
# Search audit logs
sudo ausearch -k passwd_changes
sudo ausearch -k command_exec
# Generate audit reports
sudo aureport --summary
8️⃣ Customization & Automation

🎨 Ultimate Theming Guide
GTK Theme Installation
# Install theme tools
sudo apt install gnome-tweaks
# Create themes directory
mkdir -p ~/.themes ~/.icons
# Download themes (example: Dracula)
cd ~/.themes
git clone https://github.com/dracula/gtk.git Dracula
cd ~/.icons
git clone https://github.com/dracula/gtk.git Dracula-icons
# Apply with Tweaks
gnome-tweaks
# Appearance → Themes → Applications = Dracula
# Appearance → Icons = Dracula-icons
# Popular theme sources:
# - gnome-look.org
# - github.com/dracula/gtk
# - github.com/vinceliuice/WhiteSur-gtk-theme
Terminal Customization
# Install Starship prompt (beautiful and fast)
curl -sS https://starship.rs/install.sh | sh
# Add to .bashrc
echo 'eval "$(starship init bash)"' >> ~/.bashrc
# Configure starship
mkdir -p ~/.config
starship preset nerd-font-symbols -o ~/.config/starship.toml
# Install Nerd Fonts for icons
mkdir -p ~/.local/share/fonts
cd ~/.local/share/fonts
wget https://github.com/ryanoasis/nerd-fonts/releases/download/v3.1.1/FiraCode.zip
unzip FiraCode.zip
fc-cache -fv
# Set terminal font to "FiraCode Nerd Font"
Color Scheme Setup
# Install Gogh for terminal themes
bash -c "$(wget -qO- https://git.io/vQgMr)"
# Popular choices:
# - Dracula
# - Nord
# - Gruvbox Dark
# - One Dark
# - Monokai
# Or manually set colors in terminal preferences
🤖 Advanced Bash Scripting
Script Template
#!/bin/bash
# Script: my-script.sh
# Description: Does awesome things
# Author: Your Name
# Date: 2025-01-12
set -euo pipefail # Exit on error, undefined vars, pipe fails
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Functions
log_info() {
echo -e "${GREEN}[INFO]${NC} $1"
}
log_warn() {
echo -e "${YELLOW}[WARN]${NC} $1"
}
log_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
# Check if running as root
check_root() {
if [[ $EUID -ne 0 ]]; then
log_error "This script must be run as root"
exit 1
fi
}
# Check dependencies
check_dependencies() {
local deps=("curl" "git" "jq")
for dep in "${deps[@]}"; do
if ! command -v "$dep" &> /dev/null; then
log_error "$dep is not installed"
exit 1
fi
done
}
# Main function
main() {
log_info "Starting script..."
check_dependencies
# Your code here
log_info "Script completed successfully!"
}
# Run main function
main "$@"
Useful Script Snippets
# Progress bar
show_progress() {
local duration=$1
already_done() { for ((done=0; done<$elapsed; done++)); do printf "▇"; done }
remaining() { for ((remain=$elapsed; remain<$duration; remain++)); do printf " "; done }
percentage() { printf "| %s%%" $(( (($elapsed)*100)/($duration)*100/100 )); }
clean_line() { printf "\r"; }
for (( elapsed=1; elapsed<=$duration; elapsed++ )); do
already_done; remaining; percentage
sleep 1
clean_line
done
clean_line
}
# Backup function
backup_directory() {
local source=$1
local dest=$2
local timestamp=$(date +%Y%m%d_%H%M%S)
log_info "Backing up $source..."
tar -czf "$dest/backup_$timestamp.tar.gz" "$source"
log_info "Backup completed: $dest/backup_$timestamp.tar.gz"
}
# Send notification
notify() {
local title=$1
local message=$2
notify-send "$title" "$message" --urgency=normal
}
# Menu system
show_menu() {
echo "================================"
echo " Main Menu"
echo "================================"
echo "1. Option 1"
echo "2. Option 2"
echo "3. Option 3"
echo "4. Exit"
echo "================================"
read -p "Select option [1-4]: " choice
case $choice in
1) option1 ;;
2) option2 ;;
3) option3 ;;
4) exit 0 ;;
*) echo "Invalid option" ;;
esac
}
⚙️ Systemd Service Creation
Create Custom Service
# Create service file
sudo nano /etc/systemd/system/myapp.service
[Unit]
Description=My Application Service
After=network.target
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=always
RestartSec=1
User=youruser
ExecStart=/usr/local/bin/myapp
StandardOutput=journal
StandardError=journal
[Install]
WantedBy=multi-user.target
# Reload systemd
sudo systemctl daemon-reload
# Enable and start
sudo systemctl enable myapp.service
sudo systemctl start myapp.service
# Check status
sudo systemctl status myapp.service
# View logs
sudo journalctl -u myapp.service -f
Timer (Systemd Cron Alternative)
# Create timer file
sudo nano /etc/systemd/system/backup.timer
[Unit]
Description=Daily Backup Timer
[Timer]
OnCalendar=daily
Persistent=true
[Install]
WantedBy=timers.target
# Create corresponding service
sudo nano /etc/systemd/system/backup.service
[Unit]
Description=Daily Backup Service
[Service]
Type=oneshot
ExecStart=/usr/local/bin/backup.sh
# Enable timer
sudo systemctl enable backup.timer
sudo systemctl start backup.timer
# List all timers
systemctl list-timers
9️⃣ Emergency Troubleshooting Quick Reference
🚨 System Won't Boot
Recovery Mode Access
# At GRUB menu:
# 1. Hold Shift during boot to show GRUB
# 2. Select "Advanced options"
# 3. Choose "Recovery mode"
# 4. Select "root - Drop to root shell prompt"
# Once in root shell:
mount -o remount,rw / # Remount as writable
systemctl list-units --failed # Check failed services
Fix Broken Packages
# In recovery mode or live USB
sudo dpkg --configure -a
sudo apt --fix-broken install
sudo apt update && sudo apt upgrade
Restore GRUB Bootloader
# Boot from Live USB
# Open terminal
sudo mount /dev/sdaX /mnt # Replace X with your root partition
sudo mount /dev/sdaY /mnt/boot # If separate boot partition
sudo mount --bind /dev /mnt/dev
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys
sudo chroot /mnt
# Reinstall GRUB
grub-install /dev/sda # Not sdaX, use disk not partition
update-grub
# Exit and reboot
exit
sudo umount /mnt/boot
sudo umount /mnt
sudo reboot
💾 Disk Space Emergency
# Find large files quickly
sudo du -sh /* 2>/dev/null | sort -hr | head -20
# Clean package cache
sudo apt clean
sudo apt autoclean
sudo apt autoremove
# Clean journal logs
sudo journalctl --vacuum-size=100M
# Remove old kernels (keep current + 1 backup)
dpkg -l | grep linux-image
sudo apt remove linux-image-X.X.X-XX-generic # Old versions
# Clean snap old versions
sudo snap list --all | awk '/disabled/{print $1, $3}' |
while read snapname revision; do
sudo snap remove "$snapname" --revision="$revision"
done
# Find and delete duplicates
sudo apt install fdupes
fdupes -r ~/Documents
🔥 System Frozen
Kill Unresponsive GUI
# Keyboard shortcuts:
Ctrl + Alt + F2 # Switch to TTY2
# Login with username and password
# Kill desktop environment
pkill -9 gnome-shell # For GNOME
pkill -9 plasmashell # For KDE
# Or restart display manager
sudo systemctl restart gdm3 # For GNOME
sudo systemctl restart sddm # For KDE
# Return to GUI
Ctrl + Alt + F1
Magic SysRq Keys (Last Resort)
# Enable SysRq
echo "1" | sudo tee /proc/sys/kernel/sysrq
# When system is frozen, press:
Alt + SysRq + R # Take control of keyboard
Alt + SysRq + E # Send SIGTERM to all processes
Alt + SysRq + I # Send SIGKILL to all processes
Alt + SysRq + S # Sync all filesystems
Alt + SysRq + U # Remount all filesystems read-only
Alt + SysRq + B # Reboot immediately
# Remember: REISUB (Raising Elephants Is So Utterly Boring)
🌐 Network Issues
Quick Network Restart
# Method 1: NetworkManager
sudo systemctl restart NetworkManager
# Method 2: nmcli
nmcli networking off && sleep 2 && nmcli networking on
# Method 3: Interface level
sudo ip link set wlp3s0 down && sudo ip link set wlp3s0 up
DNS Troubleshooting
# Check DNS resolution
nslookup google.com
dig google.com
# Flush DNS cache
sudo systemd-resolve --flush-caches
# Test with different DNS
# Edit temporarily
sudo nano /etc/resolv.conf
# Add:
nameserver 8.8.8.8
nameserver 8.8.4.4
# Make permanent
sudo nano /etc/NetworkManager/NetworkManager.conf
# Add under [main]:
dns=none
sudo nano /etc/resolv.conf
# Add:
nameserver 8.8.8.8
nameserver 1.1.1.1
# Restart NetworkManager
sudo systemctl restart NetworkManager
🖥️ Graphics Issues
Nvidia Driver Problems
# Check current driver
nvidia-smi
# Reinstall driver
sudo ubuntu-drivers autoinstall
# Or specific version
sudo apt install nvidia-driver-535
# Purge and reinstall
sudo apt purge nvidia-*
sudo ubuntu-drivers autoinstall
sudo reboot
Fallback to Safe Graphics
# Edit GRUB
sudo nano /etc/default/grub
# Find line: GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
# Change to: GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nomodeset"
# Update GRUB
sudo update-grub
sudo reboot
# This uses safe graphics mode
🔟 Pro Tips from 7+ Year Veterans
💡 Veteran Wisdom
Always keep a live USB handy - You never know when you'll need to rescue your system.
Backup before major changes - Use
timeshiftfor system snapshots:sudo apt install timeshift sudo timeshift --create --comments "Before system upgrade"Document your customizations - Keep a
~/setup.shscript with all your configurations:#!/bin/bash # My System Setup Script sudo apt install -y vim git htop tmux curl cp ~/dotfiles/.bashrc ~/.bashrc # ... all your customizationsUse version control for configs - Keep dotfiles in git:
cd ~ git init git add .bashrc .vimrc .gitconfig git commit -m "Initial dotfiles" git remote add origin https://github.com/yourusername/dotfiles.git git push -u origin mainLearn regex - It's everywhere in Linux. Quick reference: ```bash
Match emails
grep -E '[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,}' file.txt
Match IP addresses
grep -E '([0-9]{1,3}.){3}[0-9]{1,3}' file.txt
Match phone numbers
grep -E '(?[0-9]{3})?[-. ]?[0-9]{3}[-. ]?[0-9]{4}' file.txt
6. **Master your text editor** - Vim or Emacs, pick one and go deep:
```bash
# Vim essentials
vimtutor # Built-in tutorial (30 minutes)
# Basic survival:
i # Insert mode
Esc # Normal mode
:w # Save
:q # Quit
:wq # Save and quit
dd # Delete line
yy # Copy line
p # Paste
/search # Search forward
?search # Search backward
:%s/old/new/g # Replace all
Use
screenortmuxfor long-running tasks - SSH connection drops? No problem, your process keeps running.Read man pages - Seriously:
man <command> # Read manual man -k <keyword> # Search all manuals tldr <command> # Get simplified examples (install: npm install -g tldr)Join the community - Linux forums, subreddits, Discord servers. Help others, learn faster.
Never
rm -rf /anything unless you're 100% sure - Always double-check destructive commands: ```bashSafe deletion
rm -i file.txt # Asks for confirmation
Or use trash-cli instead of rm
sudo apt install trash-cli alias rm='trash' # Now "rm" moves to trash instead of permanent delete ```
📚 Bonus: Essential Resources
📖 Books & Guides
- "The Linux Command Line" by William Shotts - Free PDF, absolute bible
- "How Linux Works" by Brian Ward - Understanding the internals
- "Linux Bible" by Christopher Negus - Comprehensive reference
🎓 Online Learning
- Linux Journey (linuxjourney.com) - Interactive tutorials
- OverTheWire: Bandit (overthewire.org) - Learn through challenges
- Linux Academy (now A Cloud Guru) - Professional courses
🎥 YouTube Channels
- LearnLinuxTV - Excellent tutorials
- NetworkChuck - Fun, engaging content
- The Linux Experiment - Weekly Linux news
- DistroTube - Advanced topics, scripts, workflows
💬 Communities
- r/linuxquestions - Beginner-friendly
- r/linux - General Linux discussion
- r/unixporn - Desktop customization inspiration
- Linux Discord servers - Real-time help
🛠️ Tool Repositories
- GitHub Awesome Lists - github.com/awesome-foss/awesome-linux
- AlternativeTo - Find Linux alternatives to Windows apps
- Flathub - Flatpak app store
🎯 Your Action Plan
Week 1-2: Master the Basics
- [ ] Set up your environment with essential tools
- [ ] Create custom aliases and bashrc configurations
- [ ] Learn 20 most-used keyboard shortcuts
- [ ] Install and configure tmux
Week 3-4: Build Productivity
- [ ] Set up text expansion (Espanso)
- [ ] Configure clipboard manager
- [ ] Create automation scripts for repetitive tasks
- [ ] Organize workspaces by task type
Month 2: Advanced Skills
- [ ] Master one advanced tool (fzf, ripgrep, or htop)
- [ ] Set up proper backup system
- [ ] Learn basic systemd service creation
- [ ] Customize your desktop environment
Month 3+: Continuous Improvement
- [ ] Share knowledge in communities
- [ ] Document your learnings
- [ ] Experiment with new tools
- [ ] Help newcomers (teaching reinforces learning)
🎬 Conclusion
Linux mastery isn't about knowing every command or memorizing every shortcut. It's about building a workflow that amplifies your productivity and gives you complete control over your computing experience.
Start small. Pick 3-5 tips from this guide and implement them this week. Master them. Then come back for more. In three months, you'll wonder how you ever worked without these tools.
Remember: every Linux expert was once a beginner who didn't give up. The terminal that scared you yesterday will be your best friend tomorrow.
What's your next move?
Drop a comment below with:
- Which section was most helpful?
- What productivity hack are you implementing first?
- Any questions or tips you'd like to share?
Let's learn from each other. That's the Linux way. 🐧
Found this guide helpful? Check out my previous article: Switching from Windows to Linux: A Complete Beginner's Journey for the foundation, and visit Linux Fundamentals: The Engineer's Guide for deeper technical concepts.
Connect with me: GitHub | LinkedIn | Dev.to






