Linux Tips For Normal Users
By Gurjot Singh Saini , 07 Aug 2022
Linux Basics & Daily Usage – Beginner Friendly
This module builds a strong foundation for first-time Linux users. You will understand what Linux is, how it differs from Windows/macOS, and how to use Linux comfortably in daily life.
1.1 What Is Linux? History, Philosophy & Use Cases
Linux is a free and open-source operating system built around the Linux kernel.
Unlike Windows, Linux is community-driven, highly customizable, and used everywhere — from laptops and servers to Android phones and supercomputers.
1.2 Linux vs Windows vs macOS (Real Differences)
| Feature | Linux | Windows | macOS |
|---|---|---|---|
| Cost | Free | Paid | Included with Apple devices |
| Customization | Very High | Limited | Moderate |
| Security | Very Strong | Target of most malware | Strong |
1.3 Linux Distributions Explained (Ubuntu, Fedora, Mint)
- Ubuntu: Beginner-friendly, large community
- Linux Mint: Windows-like feel
- Fedora: Modern and developer-focused
1.4 Desktop Environment vs Window Manager
A Desktop Environment provides a complete visual experience (menus, settings, file manager), while a Window Manager only controls window behavior.
1.5 Linux File System Basics (/home, /etc, /var)
- /home – Your personal files
- /etc – System configuration
- /var – Logs and system data
1.6 User Files, Hidden Files & Configuration Files
Files starting with a dot (.config, .bashrc)
are hidden files used for settings.
1.7 Everyday Linux Usage for Normal Users
- Web browsing & media
- Office work
- Software installation via app store
- Updates without restarting constantly
Module 04 : Terminal & Command Line (Beginner)
This module introduces the Linux terminal - the powerful command-line interface that gives you complete control over your system. Learn essential commands, shortcuts, and best practices to become productive in the terminal.
4.1 What Is Terminal & Why Linux Uses It
The Terminal (also called console or command line) is a text-based interface to control your computer.
Unlike graphical interfaces, the terminal gives you direct access to the system, allowing you to perform complex tasks quickly with just a few keystrokes.
🎯 Why Terminal is Powerful:
- Speed: Faster than clicking through menus
- Automation: Script repetitive tasks
- Power: Access advanced system features
- Remote Access: Control servers over SSH
- Consistency: Same commands work across different Linux systems
4.2 Understanding Shells (bash, zsh)
A Shell is the program that interprets your commands in the terminal. It's your interface to the operating system.
🐚 Common Shell Types:
| Shell | Description | Best For | Default Color |
|---|---|---|---|
| bash | Bourne Again SHell - Most common, default on most systems | Beginners & compatibility | Blue prompt |
| zsh | Z Shell - Feature-rich with autocomplete & themes | Power users & customization | Green prompt |
| fish | Friendly Interactive SHell - User-friendly with syntax highlighting | Those who want modern features | Yellow prompt |
🔍 How to Check Your Current Shell:
# Check which shell you're usingecho $SHELL# Output example: /bin/bash# See all available shells on your systemcat /etc/shells
user@computer:~$) shows your username, computer name, and current directory.
4.3 Basic Commands (ls, cd, pwd, clear)
These four commands are the foundation of Linux navigation. Master these, and you can explore anywhere!
🚀 The Essential Four:
| Command | What It Does | Basic Usage | Common Options |
|---|---|---|---|
pwd |
Print Working Directory - Shows where you are | pwd |
(no options) |
ls |
List files and directories | ls |
-l (details), -a (all), -h (human readable) |
cd |
Change Directory - Move to different folder | cd folder_name |
cd .. (go up), cd ~ (go home) |
clear |
Clear screen - Makes terminal empty | clear |
Ctrl + L (keyboard shortcut) |
🎮 Hands-On Practice:
# 1. See where you arepwd# Output: /home/your_username# 2. List files in current directorylsls -la # List all files with details# 3. Navigate to Documents foldercd Documentspwd # Now shows: /home/your_username/Documents# 4. Go back homecd ~# OR simply: cd# 5. Clean up the screenclear
Documents ≠ documents ≠ DOCUMENTS
4.4 Working with Files & Directories
Now that you can navigate, let's learn how to create and organize your files and folders.
📁 File & Directory Management Commands:
| Command | Purpose | Example | What Happens |
|---|---|---|---|
mkdir |
Make Directory (create folder) | mkdir my_folder |
Creates "my_folder" |
touch |
Create empty file | touch file.txt |
Creates "file.txt" (0 bytes) |
cat |
View file contents | cat file.txt |
Shows file content |
nano |
Simple text editor | nano notes.txt |
Opens editor to create/edit |
rmdir |
Remove empty directory | rmdir empty_folder |
Deletes empty folder |
🛠️ Practical Example - Organize Your Files:
# Create a project structuremkdir my_projectcd my_project# Create subfoldersmkdir docs images codels # Shows: docs images code# Create filestouch README.txtcd docstouch notes.txt# Add content to a fileecho "Project started on $(date)" > notes.txtcat notes.txt # View the content# Edit with nanonano notes.txt# Add more text, then Ctrl+X to save and exit
📝 Nano Editor Basics:
• Ctrl + O : Save file
• Ctrl + X : Exit Nano
• Ctrl + K : Cut line
• Ctrl + U : Paste line
• Ctrl + W : Search
• Ctrl + \ : Replace
All shortcuts shown at bottom of screen
4.5 Copy, Move & Delete Safely
These commands manipulate files. Be careful with delete - there's no "Recycle Bin" in terminal!
⚠️ Safety First - The Dangerous Commands:
| Command | Purpose | Safe Version | Danger Level |
|---|---|---|---|
cp |
Copy files/directories | cp -i file1 file2 |
Low |
mv |
Move or rename files | mv -i old new |
Medium |
rm |
Remove (delete) files | rm -i file.txt |
HIGH |
rm -rf / |
NEVER USE THIS! | Just don't | SUICIDE |
🔧 Safe Operations with Examples:
# COPYING FILEScp file.txt file_backup.txt # Basic copycp -i file.txt file_backup.txt # Ask before overwritingcp -r folder/ backup/ # Copy folder recursively# MOVING/RENAMINGmv file.txt new_name.txt # Rename filemv file.txt Documents/ # Move to foldermv -i old.txt new.txt # Ask before overwrite# DELETING (BE CAREFUL!)rm file.txt # Delete single filerm -i important.txt # ASK before deletingrm -r old_folder/ # Delete folder with contentsrmdir empty_folder/ # Delete ONLY if empty
🛡️ Safety Aliases (Add to ~/.bashrc):
# Make commands ask before doing dangerous thingsalias cp='cp -i' # Ask before overwriting copyalias mv='mv -i' # Ask before overwriting movealias rm='rm -i' # ASK before deleting anything# Prevent accidental deletion of system filesalias rm='rm -I --preserve-root'
rm -rf / or rm -rf /* - it will delete EVERYTHING on your system!
~/.local/share/Trash (GUI deletions) or use file recovery tools immediately.
4.6 Command History, Autocomplete & Shortcuts
These productivity features will make you 10x faster in the terminal. Learn them early!
📜 Command History - Your Time Machine:
# View command historyhistory # Shows all commands you've typedhistory 10 # Show last 10 commands!45 # Run command #45 from history!! # Run last command again!ls # Run last 'ls' commandCtrl + R # Search history (reverse-i-search)# Type to search, press Enter to run, Ctrl+C to cancel
🚀 Tab Autocomplete - Your Best Friend:
• Type
cd Docu then press Tab → completes to cd Documents/• Press Tab twice → shows all possible completions
• Works for commands, files, folders, and options!
⌨️ Essential Keyboard Shortcuts:
| Shortcut | Action | Why It's Useful |
|---|---|---|
| Tab | Auto-complete | Saves typing, prevents typos |
| Ctrl + A | Move cursor to beginning | Quick edit long commands |
| Ctrl + E | Move cursor to end | Add arguments quickly |
| Ctrl + U | Cut to beginning | Clear current command |
| Ctrl + K | Cut to end | Remove rest of line |
| Ctrl + Y | Paste cut text | Undo Ctrl+U/K cuts |
| Ctrl + R | Search history | Find old commands fast |
| Ctrl + C | Cancel/stop command | Stop running programs |
| Ctrl + D | Exit shell/logout | Close terminal session |
| Ctrl + L | Clear screen | Better than typing 'clear' |
| ↑ / ↓ | Navigate history | Cycle through past commands |
🎮 Practice Exercise:
# 1. Type this long command:echo "Hello this is a long command to practice shortcuts"# 2. Press Ctrl+A to go to beginning# 3. Press Ctrl+K to cut everything# 4. Type: ls -la# 5. Press Ctrl+Y to paste back the echo command# 6. Press Ctrl+C to cancel# Practice tab completion:cd /usr/share/ # Then press Tab multiple timesls /e # Press Tab → completes to /etc/
4.7 Linux Aliases - Custom Command Shortcuts
Aliases are your personal command shortcuts - create custom names for frequently used commands!
🎯 Why Create Aliases?
- Save Time: Shorten
ls -lato justll - Reduce Errors: Avoid typos in complex commands
- Create Workflows: Chain multiple commands together
- Personalize: Build your own command language
🔧 Creating Aliases:
# Temporary alias (lasts only this session)alias ll='ls -la'll # Now works as ls -la!# Permanent alias (add to ~/.bashrc)nano ~/.bashrc# Add at bottom:alias ll='ls -la'alias update='sudo apt update && sudo apt upgrade'alias cl='clear'alias ..='cd ..'# Save (Ctrl+X, Y, Enter) then reload: source ~/.bashrc
🌟 Useful Beginner Aliases:
# Navigationalias home='cd ~'alias ..='cd ..'alias ...='cd ../..'alias ....='cd ../../..'# Listingalias l='ls -CF'alias la='ls -A'alias ll='ls -la'alias lh='ls -lh'# Safety first!alias rm='rm -i' # Ask before deletingalias cp='cp -i' # Ask before overwritingalias mv='mv -i' # Ask before moving# System infoalias cpu='top -o %CPU'alias mem='top -o %MEM'alias disk='df -h'alias space='du -sh * | sort -h'
🛠️ Managing Your Aliases:
# List all current aliasesalias# OR: alias -p# Check specific aliastype ll# Output: ll is aliased to `ls -la`# Remove an aliasunalias ll# Create separate alias file (recommended)nano ~/.bash_aliases# Add all aliases here, then add this to ~/.bashrc:if [ -f ~/.bash_aliases ]; then . ~/.bash_aliasesfi
🎮 Hands-On Exercise:
# 1. Create a test aliasalias greet='echo "Hello from your alias!"'greet # Should show greeting# 2. Create update shortcutalias update-system='sudo apt update && sudo apt upgrade -y'# 3. Make it permanentecho 'alias ll="ls -la"' >> ~/.bashrcecho 'alias update="sudo apt update && sudo apt upgrade -y"' >> ~/.bashrcsource ~/.bashrc # Reload# 4. Test your new powers!ll ~/Documents# (Might need sudo for update if not Ubuntu/Debian)
4.8 Common Beginner Terminal Mistakes
Everyone makes mistakes when learning terminal. Here's how to avoid (and recover from) the most common ones.
🚫 Top 10 Terminal Mistakes & Solutions:
| Mistake | Why It Happens | How to Avoid | How to Fix |
|---|---|---|---|
rm -rf / |
Thinking it will "remove folder root" | NEVER type this. Use aliases for safety | Too late. Reinstall OS. |
Wrong case: Documents vs documents |
Linux is case-sensitive | Use Tab to autocomplete | Check spelling and case |
| Spaces in file names without quotes | touch my file.txt creates TWO files |
Use underscores: my_file.txt |
Use quotes: touch "my file.txt" |
Forgetting sudo |
Need admin rights for system changes | Error will tell you "Permission denied" | Add sudo before command |
Using wrong slash: \ vs / |
Windows uses backslash, Linux uses forward | Linux always uses / |
Replace \ with / |
| Command not found | Typo or package not installed | Use Tab, check spelling | Install package: sudo apt install package_name |
| Accidental Ctrl + D | Meant to cancel but exited terminal | Use Ctrl + C to cancel | Just reopen terminal |
Forgetting to cd into folder |
Running command in wrong directory | Always check with pwd first |
cd to correct folder |
| Missing arguments | rm needs file name |
Read error messages carefully | Add required arguments |
| Running command as wrong user | Need sudo or different user |
Check who you are: whoami |
Use sudo or switch user |
🔧 Recovery Techniques:
# 1. Stuck in a program?Press: Ctrl + C # Cancel current commandPress: Ctrl + Z # Pause program (bg/fg to manage)Press: Ctrl + D # Send EOF (may exit)# 2. Typed wrong command?Press: Ctrl + C # Stop it immediatelyUse: history # Find correct commandUse: !! # Rerun last command# 3. Deleted wrong file?# Check trash: ls ~/.local/share/Trash/files/# Use recovery tools immediately (testdisk, photorec)# 4. Lost in filesystem?pwd # Where am I?cd ~ # Go homecd / # Go to rootcd - # Go to previous directory
🛡️ Preventive Safety Measures:
# 1. Create safety aliases in ~/.bashrcalias rm='rm -i' # Ask before deletealias cp='cp -i' # Ask before overwritealias mv='mv -i' # Ask before move# 2. Backup important files regularlycp important.txt important.txt.backup# OR use version control: git init# 3. Test commands with echo firstecho rm *.txt # Shows what WOULD be deleted# Then remove 'echo' to actually run# 4. Use dry-run options when availablersync -nav source/ destination/ # -n = dry run
🎮 Practice - Making (Safe) Mistakes:
# Create a safe practice areamkdir ~/terminal_practicecd ~/terminal_practicetouch file1.txt file2.txt file3.txt# Practice common scenarios# 1. Case sensitivityls FILE1.TXT # Fails - wrong casels file1.txt # Works# 2. Spaces in namestouch "my document.txt" # Use quotesls my\ document.txt # OR use backslash# 3. Permission errorsmkdir /system_folder # Fails - need sudosudo mkdir /system_folder # Works with sudo# 4. Tab completionls f # Completes to file ls fi # Shows all matches # Clean upcd ~rm -r terminal_practice/
rm, format, or dd - STOP. Double-check everything.
Internet, Browsers & Networking – Connectivity Mastery
This module covers everything about staying connected on Linux. You'll learn how to manage browsers, fix network issues, use Bluetooth devices, and secure your connection with firewalls and VPNs.
6.1 Browsers on Linux (Firefox, Chrome)
Linux supports all major browsers. Firefox is usually pre-installed and optimized for Linux, while Google Chrome and Chromium are available for download.
- Firefox: Default on most distributions, privacy-focused
- Chrome: Available as .deb or .rpm package
- Chromium: Open-source version of Chrome
- Brave: Privacy browser with built-in ad blocking
6.2 Network Manager Explained
NetworkManager is the default networking service on most Linux distributions. It manages Wi-Fi, Ethernet, VPN, and mobile broadband connections through both GUI and CLI.
| Tool | Purpose | How to Access |
|---|---|---|
| nm-applet | System tray network icon | Click system tray icon |
| nmtui | Text-based UI for terminal | Run nmtui in terminal |
| nmcli | Command-line interface | Run nmcli commands |
nmtui when GUI isn't working – it's a lifesaver!
6.3 Wi-Fi & Ethernet Troubleshooting
Network issues are common but usually easy to fix. Follow this troubleshooting checklist:
- Check if Wi-Fi is enabled: Look for airplane mode or hardware switch
- Verify driver installation: Run
lspci -k | grep -A 2 -i network - Restart NetworkManager:
sudo systemctl restart NetworkManager - Check connection details:
ip addr showorifconfig - Test DNS:
ping 8.8.8.8(if this works but websites don't, it's DNS)
6.4 Bluetooth Setup & Troubleshooting
Linux has excellent Bluetooth support for headphones, speakers, mice, and keyboards. Most distributions include Bluez (the standard Bluetooth stack).
Quick Setup:
- Ensure Bluetooth is enabled: Click system tray icon or check settings
- Put your device in pairing mode
- Search for devices and connect
Complete Bluetooth Installation & Setup:
| Task | Command | Purpose |
|---|---|---|
| Install Bluetooth stack | sudo apt install bluez* |
Install all Bluez packages |
| Install Bluetooth manager | sudo apt install blueman |
GUI tool for Bluetooth management |
| Enable Bluetooth service | sudo systemctl enable bluetooth.service |
Start Bluetooth on boot |
| Start Bluetooth service | sudo systemctl start bluetooth.service |
Start Bluetooth immediately |
| Check service status | sudo systemctl status bluetooth.service |
Verify Bluetooth is running |
Common Issues & Fixes:
| Problem | Solution | Description |
|---|---|---|
| Bluetooth not showing in GUI | sudo systemctl start bluetooth |
Start the Bluetooth service |
| Device not found | bluetoothctl then scan on |
Use command-line tool to search |
| Audio quality poor | sudo apt install pulseaudio-module-bluetoothpulseaudio -k |
Install Bluetooth audio support & restart PulseAudio |
| Connection drops frequently | sudo btmgmt power offsudo hciconfig hci0 up |
Disable power saving & bring interface up |
| Missing Bluetooth packages | sudo apt install aptitudesudo aptitude install bluetooth |
Use aptitude for better dependency handling |
| Bluetooth service won't start | sudo /etc/init.d/bluetooth restartservice bluetooth restart |
Alternative service restart commands |
| Bluetooth not enabled at boot | sudo systemctl enable bluetoothCheck: systemctl is-enabled bluetooth |
Ensure Bluetooth starts automatically |
Step-by-Step Troubleshooting Guide:
- Check if Bluetooth adapter is detected:
lsusb | grep -i bluetooth hciconfig -a bluetoothctl list - Enable and start the service:
sudo systemctl enable bluetooth sudo systemctl start bluetooth sudo systemctl status bluetooth - Install missing packages:
sudo apt update sudo apt install bluez blueman bluez-tools sudo apt install pulseaudio-module-bluetooth - Using bluetoothctl (command-line tool):
bluetoothctl # Enter Bluetooth control power on # Turn Bluetooth on agent on # Enable agent default-agent # Set as default scan on # Start scanning (wait 30 sec) devices # List found devices pair XX:XX:XX:XX:XX # Pair with device MAC connect XX:XX:XX:XX:XX # Connect to device trust XX:XX:XX:XX:XX # Trust device for auto-connect exit # Exit bluetoothctl
bluetoothctl shows "No default controller available", run:sudo rmmod btusb then sudo modprobe btusb to reload Bluetooth drivers.
- For SysV init:
sudo service bluetooth restart - For systemd:
sudo systemctl restart bluetooth - Check your init system:
ps -p 1 -o comm=
- Install packages:
sudo apt install bluez blueman - Enable service:
sudo systemctl enable --now bluetooth - Check adapter:
hciconfig -a - Restart if needed:
sudo systemctl restart bluetooth
6.5 Checking Network Using Terminal
The terminal provides powerful tools for diagnosing network issues. Here are essential commands:
| Command | What It Does | Example |
|---|---|---|
ping |
Test connection to a server | ping google.com |
ip addr |
Show network interfaces & IPs | ip addr show |
nslookup |
Check DNS resolution | nslookup google.com |
traceroute |
Trace network path to server | traceroute google.com |
ss or netstat |
Show active connections | ss -tulpn |
ip command replaces old ifconfig - learn it for modern systems.
6.6 Firewall Basics (UFW Explained)
UFW (Uncomplicated Firewall) is an easy-to-use firewall for Linux. It's a frontend for iptables that simplifies firewall management.
Basic UFW Commands:
sudo ufw enable # Turn on firewall
sudo ufw disable # Turn off firewall
sudo ufw status # Check status
sudo ufw allow ssh # Allow SSH (port 22)
sudo ufw allow 80/tcp # Allow HTTP
sudo ufw deny from 192.168.1.10 # Block specific IP
Common Use Cases:
- Allow web server:
sudo ufw allow 80,443/tcp - Allow specific application:
sudo ufw allow OpenSSH - Deny all incoming, allow all outgoing (default)
- Rate limiting:
sudo ufw limit ssh
6.7 VPN Usage & Privacy on Linux
Using a VPN on Linux is straightforward. Most VPN providers offer Linux apps, or you can use NetworkManager's built-in VPN support.
VPN Setup Methods:
- Official VPN apps: Many providers have .deb/.rpm packages
- NetworkManager integration: Import .ovpn files
- Command line: Use
openvpnorwireguardtools - Browser extensions: For browser-only VPN
Popular Linux VPN Clients:
- OpenVPN: Standard protocol with GUI (network-manager-openvpn)
- WireGuard: Modern, fast, simple configuration
- NordVPN/ExpressVPN: Official Linux clients available
Privacy Tips:
- Use DNS over HTTPS in Firefox/Chrome
- Consider using Tor Browser for maximum anonymity
- Regularly check for DNS leaks: dnsleaktest.com
- Disable unnecessary network services
Essential Linux Commands – Complete Reference & Daily Usage
This module provides a comprehensive reference of essential Linux commands organized by category. Each command includes syntax, options, practical examples, and real-world use cases.
💡 How to use this module: Bookmark this page and return whenever you need to understand a specific command. Each section is self-contained with command details, common options, and beginner-friendly explanations.
sudo or root privileges.
Always understand a command before running it, especially with sudo.
10.1 File System Navigation Commands
These commands help you move around and explore the Linux file system. Mastering navigation is the first step to terminal confidence.
📁 pwd – Print Working Directory
Purpose: Shows the full path of your current directory.
pwd
# Output: /home/username/Documents
Real-world use: When you're lost in the terminal and need to know exactly where you are.
📋 ls – List Directory Contents
Purpose: Displays files and directories in the current location.
| Option | Description | Example |
|---|---|---|
ls -l | Long format (permissions, size, date) | ls -l /home |
ls -a | Show hidden files (starting with .) | ls -la |
ls -h | Human-readable sizes | ls -lh |
ls -t | Sort by modification time | ls -lt |
ls -R | Recursive (show subdirectories) | ls -R /etc |
ls -la is the most commonly used combination.
🔄 cd – Change Directory
Purpose: Move between directories.
cd /path | Go to specific directory | cd /var/log |
cd ~ or cd | Go to home directory | cd ~ |
cd .. | Go up one level | cd ../.. (up two levels) |
cd - | Go to previous directory | cd - |
🌳 tree – Display Directory Structure
Purpose: Shows directories and files in a tree-like format.
tree
tree -L 2 # Limit to 2 levels deep
tree -a # Include hidden files
Install if missing: sudo apt install tree
📌 pushd / popd – Directory Stack
Purpose: Navigate between multiple directories efficiently.
pushd /var/log # Save current dir and move to /var/log
pushd /etc # Save and move to /etc
popd # Return to previous directory
dirs # Show directory stack
10.2 File & Directory Management Commands
Create, copy, move, rename, and delete files and directories safely.
📄 touch – Create Empty File / Update Timestamp
touch file.txt # Create new empty file
touch -t 202502111430 file.txt # Set specific timestamp
touch file{1..5}.txt # Create file1.txt through file5.txt
📂 mkdir – Create Directories
mkdir newfolder
mkdir -p parent/child/grandchild # Create nested directories
mkdir dir_{1..3} # Create dir_1, dir_2, dir_3
mkdir -m 755 securedir # Create with specific permissions
🗑️ rm – Remove Files & Directories
| Command | Description | Example |
|---|---|---|
rm file.txt | Remove single file | rm old.txt |
rm -r folder | Remove directory and contents | rm -r downloads/ |
rm -f file | Force remove (no confirmation) | rm -f log.txt |
rm -rf /path | ⚠️ Dangerous: force recursive delete | rm -rf temp/ |
rm -i *.txt | Interactive (ask before each) | rm -i *.log |
📋 cp – Copy Files & Directories
cp source dest | Copy file | cp file.txt backup.txt |
cp -r dir1 dir2 | Copy directory recursively | cp -r /etc /etc-backup |
cp -i file dest | Interactive (ask before overwrite) | cp -i data.txt /backup/ |
cp -p file dest | Preserve permissions & timestamps | cp -p config.conf /etc/ |
cp -a source dest | Archive mode (preserve all attributes) | cp -a /home/user /backup/ |
✂️ mv – Move / Rename
mv oldname.txt newname.txt # Rename file
mv file.txt /path/to/destination/ # Move file
mv -i source dest # Interactive (ask before overwrite)
mv -u source dest # Update - move only when source is newer
mv folder1 folder2 # Rename or move directory
🔗 ln – Create Links
Hard link vs Soft link (symlink):
ln file.txt hardlink.txt # Hard link (same inode)
ln -s /original/file symlink # Soft/symbolic link (shortcut)
ln -s /usr/bin/python3 python # Create alias for command
10.3 File Viewing & Editing Commands
View file contents without opening full editors, or edit directly in terminal.
👁️ cat – Concatenate & Display
cat file.txt # Display entire file
cat file1.txt file2.txt > combined.txt # Merge files
cat > newfile.txt # Create file (Ctrl+D to save)
cat -n code.py # Show with line numbers
📖 less / more – Page Through Files
less is more powerful than more (backwards navigation allowed).
less /var/log/syslog
dmesg | less # Pipe output to less
Navigation: Space (next page), b (previous), g (top), G (bottom), / (search), q (quit)
🔍 head / tail – View Beginning/End of Files
head file.txt | Show first 10 lines | head -n 20 file.txt (20 lines) |
tail file.txt | Show last 10 lines | tail -n 50 file.txt (50 lines) |
tail -f logfile.log | Follow mode (live updates) | tail -f /var/log/syslog |
tail -f -n 100 app.log | Follow with initial 100 lines | Debugging applications |
tail -f is essential for watching log files in real-time.
📝 nano – Simple Terminal Text Editor
Best for beginners - intuitive and easy to use.
nano file.txt # Open file
nano -l file.txt # Show line numbers
nano -B file.txt # Create backup (.bak)
Shortcuts: Ctrl+O (save), Ctrl+X (exit), Ctrl+W (search), Ctrl+K (cut line)
⚡ vim – Advanced Text Editor
Powerful but has learning curve. Modes: Normal, Insert, Visual, Command.
vim file.txt # Open file
vim +20 file.txt # Open at line 20
vimdiff file1.txt file2.txt # Compare files
Essential vim commands: i (insert), :w (save), :q (quit), :wq (save & quit), u (undo)
📊 stat – Display File Status
stat file.txt
# Output includes: Size, Permissions, Access/Modify/Change timestamps, Inode
Useful for: Checking when file was actually modified vs changed permissions.
🔢 nl – Number Lines
nl script.sh # Show with line numbers
nl -b a file.txt # Number all lines (including blank)
10.4 File Permissions & Ownership Commands
Control who can read, write, and execute files. Essential for security and multi-user systems.
User(owner) | Group | Others → Example: 755 = rwxr-xr-x
🔐 chmod – Change File Permissions
Numeric mode (octal):
chmod 755 script.sh # rwxr-xr-x (owner: all, group/others: read/execute)
chmod 644 file.txt # rw-r--r-- (owner: read/write, others: read only)
chmod 600 private.key # rw------- (owner only, for SSH keys)
chmod 777 file ⚠️ Dangerous: read/write/execute for everyone
Symbolic mode:
chmod u+x script.sh # Add execute for user
chmod g-w file.txt # Remove write for group
chmod o+r file.txt # Add read for others
chmod a+x script.sh # Add execute for all (ugo)
chmod -R 755 directory/ # Recursive change
👑 chown – Change File Owner
⚡ Requires sudo privileges.
sudo chown username file.txt # Change owner
sudo chown username:groupname file.txt # Change owner and group
sudo chown :groupname file.txt # Change only group
sudo chown -R username:group directory/ # Recursive
sudo chown www-data:www-data /var/www/html - Set web server ownership
👥 chgrp – Change Group Ownership
sudo chgrp developers project/ # Change group to 'developers'
sudo chgrp -R staff /shared/ # Recursive group change
🎭 umask – Set Default Permissions
Purpose: Determines default permissions for new files/directories.
umask # Show current umask (usually 0022)
umask 077 # New files: 600, directories: 700 (private)
umask 022 # New files: 644, directories: 755 (default)
Calculation: File permissions = 666 - umask, Directory = 777 - umask
🔒 chattr – Change File Attributes (Advanced)
⚡ Root privileges required. Sets immutable/append-only flags.
sudo chattr +i important.conf # Make file immutable (can't be deleted/modified)
sudo chattr -i important.conf # Remove immutable flag
sudo chattr +a logfile.log # Append-only mode
lsattr file.txt # List attributes
10.5 Process Management Commands
Monitor, control, and terminate running programs and processes.
📊 ps – Process Status
Purpose: Snapshot of current processes.
ps | Processes in current shell | ps |
ps aux | All processes (BSD syntax) | ps aux | grep firefox |
ps -ef | All processes (standard syntax) | ps -ef --forest (tree view) |
ps -u username | Processes for specific user | ps -u www-data |
ps -C command | Processes by command name | ps -C apache2 |
Common columns: PID (Process ID), %CPU, %MEM, VSZ, RSS, TTY, STAT, START, TIME, COMMAND
📈 top / htop – Interactive Process Viewer
top # Default process viewer
htop # Enhanced, color-coded, easier to use
top -u username # Show only user's processes
top -p 1234,5678 # Monitor specific PIDs
top shortcuts: q (quit), k (kill process), u (filter by user), 1 (show CPU cores)
sudo apt install htop
🛑 kill / pkill – Terminate Processes
| Signal | Number | Purpose | Example |
|---|---|---|---|
| SIGTERM | 15 | Graceful termination (default) | kill 1234 |
| SIGKILL | 9 | Force kill (cannot be ignored) | kill -9 1234 |
| SIGHUP | 1 | Hangup (reload config) | kill -1 1234 |
| SIGSTOP | 19 | Pause process | kill -19 1234 |
| SIGCONT | 18 | Continue paused process | kill -18 1234 |
pkill - kill by name:
pkill firefox # Kill all firefox processes
pkill -f "python script.py" # Kill by full command line
pkill -u username # Kill all processes of user
kill (SIGTERM) before kill -9 (SIGKILL).
⚖️ nice / renice – Process Priority
Priority range: -20 (highest) to 19 (lowest). Default: 0.
nice -n 10 ./backup-script.sh # Start with lower priority
sudo renice -5 -p 1234 # Change priority of PID 1234 (higher)
sudo renice +5 -u username # Lower priority for user's processes
nice for CPU-intensive background tasks.
⬇️⬆️ bg / fg – Job Control
command & # Start process in background
Ctrl+Z # Suspend foreground process
bg # Resume suspended job in background
fg # Bring background job to foreground
jobs # List background jobs
kill %1 # Kill job number 1
🔄 nohup – Run Immune to Hangups
Purpose: Continue running after terminal closes.
nohup long-script.sh & # Run in background, survives logout
nohup python server.py > output.log 2>&1 & # With custom log file
Output goes to nohup.out by default.
🖥️ screen / tmux – Terminal Multiplexers
screen (pre-installed on most systems):
screen -S session_name # Start named session
Ctrl+A, D # Detach from session
screen -ls # List sessions
screen -r session_name # Reattach to session
tmux (more modern): sudo apt install tmux
tmux new -s session_name
Ctrl+B, D # Detach
tmux attach -t session_name
10.6 System Information Commands
Get details about your Linux system, kernel, hardware, and environment.
🖥️ uname – System Information
uname -a # All system information (kernel, hostname, arch)
uname -r # Kernel release version
uname -m # Machine hardware (x86_64, aarch64)
uname -n # Network node hostname
Example output: Linux mypc 5.15.0-91-generic #101-Ubuntu SMP x86_64
🏷️ hostname – System Hostname
hostname # Show current hostname
sudo hostname new-name # Temporarily change hostname
hostname -I # Show IP addresses (capital i)
hostnamectl # Detailed hostname info (systemd)
Permanent change: Edit /etc/hostname and /etc/hosts
⏰ uptime – System Running Time
uptime
# 14:23:01 up 3 days, 2:15, 3 users, load average: 0.08, 0.12, 0.10
Shows: Current time, uptime, logged-in users, load averages (1, 5, 15 minutes)
👤 whoami / id – User Identity
whoami # Current username
id # User ID, group ID, groups
id username # Info about specific user
groups # Show groups for current user
📅 date / cal – Date & Calendar
date # Current date/time
date +"%Y-%m-%d %H:%M:%S" # Custom format
sudo date -s "2025-02-11 15:30:00" # Set date (requires sudo)
cal # Current month calendar
cal 2025 # Full year calendar
cal -3 # Previous, current, next month
🧮 bc – Command Line Calculator
echo "12 * 5" | bc # Basic arithmetic
echo "scale=2; 10/3" | bc # Decimal precision
bc -l # Start interactive mode with math library
📢 echo – Display Text
echo "Hello World"
echo $HOME # Show variable value
echo -e "Line1\nLine2" # Enable escape sequences
echo -n "No newline" # Suppress trailing newline
🌍 env – Environment Variables
env # Show all environment variables
export MYVAR="value" # Set environment variable
unset MYVAR # Remove variable
echo $PATH # Show executable search path
~/.bashrc to make environment variables permanent.
🔄 which / whereis – Locate Commands
which python # Show path to executable
which -a python # Show all matches in PATH
whereis python # Show binary, source, man pages
10.7 User Management Commands
Create, modify, and delete users and groups. ⚡ All commands require sudo.
👤 useradd / adduser – Create Users
useradd (low-level):
sudo useradd username # Create user (basic)
sudo useradd -m -s /bin/bash username # Create with home dir and shell
sudo useradd -u 1500 -g groupname username # Specific UID and primary group
adduser (friendly, recommended):
sudo adduser username # Interactive, creates home, prompts for password
✏️ usermod – Modify Users
sudo usermod -aG sudo username # Add user to sudo group (Ubuntu)
sudo usermod -aG docker username # Add to docker group
sudo usermod -s /bin/zsh username # Change default shell
sudo usermod -l newname oldname # Change username
sudo usermod -L username # Lock user account
sudo usermod -U username # Unlock user account
-aG (append) with groups, never -G alone (removes other groups).
🗑️ userdel – Delete Users
sudo userdel username # Remove user
sudo userdel -r username # Remove user and home directory
sudo userdel -f username # Force removal (even if logged in)
🔑 passwd – Change Passwords
passwd # Change own password
sudo passwd username # Change another user's password
sudo passwd -l username # Lock password (disable login)
sudo passwd -u username # Unlock password
sudo passwd -e username # Expire password (force change on next login)
👥 groupadd / groupdel – Manage Groups
sudo groupadd groupname # Create new group
sudo groupdel groupname # Delete group
sudo groupmod -n newname oldname # Rename group
sudo gpasswd -d username groupname # Remove user from group
📋 who / w / last – Login Information
who # Who is logged in
w # More detailed: what users are doing
last # Login history (reads /var/log/wtmp)
last -n 10 # Last 10 logins
lastb # Failed login attempts
🔄 su – Switch User
su - username # Switch to user with their environment
su - # Switch to root (requires root password)
sudo su - # Switch to root using sudo (Ubuntu style)
10.8 Network Commands
Configure, monitor, and troubleshoot network connections.
🌐 ip – Modern Network Configuration
Replacement for deprecated ifconfig.
ip addr show # Show IP addresses
ip link show # Show network interfaces
ip route show # Show routing table
sudo ip addr add 192.168.1.100/24 dev eth0 # Add IP address
sudo ip link set eth0 up/down # Enable/disable interface
📶 ping – Test Connectivity
ping google.com # Ping until Ctrl+C
ping -c 4 8.8.8.8 # Send 4 packets
ping -i 2 -c 10 example.com # 2 second intervals
ping -s 1472 example.com # Set packet size
Return codes: 0 (host reachable), 1 (unreachable), 2 (other error)
📊 netstat / ss – Network Statistics
ss is faster, modern replacement for netstat.
ss -tuln # Show listening ports (tcp, udp, listening, numeric)
ss -tup # Show established connections with process
netstat -i # Interface statistics
netstat -r # Routing table
ss -tuln | grep :80 to check if web server is running.
🔍 nslookup / dig – DNS Lookup
nslookup google.com # Basic DNS query
dig google.com # Detailed DNS information
dig -x 8.8.8.8 # Reverse lookup (IP to hostname)
dig @8.8.8.8 example.com # Use specific DNS server
dig MX gmail.com # Query mail exchange records
🛤️ traceroute – Network Path
traceroute google.com # Show path packets take
mtr google.com # Combined traceroute + ping (real-time)
tracepath example.com # Similar, no root needed
📡 wget / curl – Download Files
wget https://example.com/file.zip # Download file
wget -c https://example.com/large.zip # Resume download
wget -r -np -nH --cut-dirs=1 https://site.com/files/ # Recursive download
curl -O https://example.com/file.zip # Download (save as filename)
curl -o custom.zip https://example.com/file.zip # Download with custom name
curl -I https://example.com # Fetch HTTP headers only
📱 nmcli – NetworkManager CLI
For systems with NetworkManager (most desktop distros).
nmcli dev status # Device status
nmcli con show # Show connections
nmcli con up/down id "Connection Name" # Connect/disconnect
nmcli dev wifi list # Scan WiFi networks
nmcli dev wifi connect SSID password PASSWORD # Connect to WiFi
10.9 Package Management Commands
Install, update, and remove software on Debian/Ubuntu systems.
📦 apt – Advanced Package Tool
Modern, user-friendly package manager.
| Command | Description | Example |
|---|---|---|
sudo apt update | Update package lists | Always run first |
sudo apt upgrade | Upgrade all packages | sudo apt upgrade -y |
sudo apt install package | Install package | sudo apt install vim |
sudo apt remove package | Remove package | sudo apt remove firefox |
sudo apt purge package | Remove + config files | sudo apt purge apache2 |
apt search keyword | Search packages | apt search pdf editor |
apt show package | Show package details | apt show python3 |
apt list --installed | List installed packages | apt list --installed | grep python |
sudo apt autoremove | Remove unused dependencies | Clean up orphaned packages |
sudo apt autoclean | Remove old .deb files | Free disk space |
apt combines features from apt-get and apt-cache with better output.
🔧 dpkg – Debian Package Manager
Lower-level tool for working with .deb files.
sudo dpkg -i package.deb # Install local .deb file
sudo dpkg -r package # Remove package
dpkg -l # List installed packages
dpkg -L package # List files installed by package
dpkg -S /path/to/file # Find which package owns file
sudo dpkg --configure -a # Fix interrupted installations
📱 snap / flatpak – Universal Packages
Sandboxed applications that work across distributions.
snap find searchterm # Search snaps
sudo snap install package # Install snap
snap list # List installed snaps
sudo snap refresh package # Update snap
flatpak search app # Search Flatpak
flatpak install flathub app # Install Flatpak
flatpak run app # Run Flatpak app
🔄 apt-get – Legacy Package Tool
Traditional command, still widely used in scripts.
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade # Smart dependency resolution
sudo apt-get install -f # Fix broken dependencies
sudo apt-get clean # Clear package cache
10.10 Disk & Storage Commands
Monitor disk usage, partition drives, and manage filesystems.
💾 df – Disk Free Space
df -h # Human-readable sizes (GB, MB)
df -T # Show filesystem type
df -i # Inode usage (important for mail servers)
df -h --total # Show total at end
Example output: /dev/sda1 100G 45G 55G 45% /
📊 du – Disk Usage
du -sh folder/ # Total size of directory
du -h --max-depth=1 # Size of immediate subdirectories
du -ah folder/ # Show size of each file
du -sh * | sort -h # Sort by size (smallest to largest)
du -sh * | sort -rh # Sort by size (largest first)
du -ah /home 2>/dev/null | sort -rh | head -20
💽 lsblk – List Block Devices
lsblk # Tree view of disks and partitions
lsblk -f # Include filesystem info
lsblk -m # Show permissions and owner
lsblk -o NAME,SIZE,TYPE,MOUNTPOINT,LABEL # Custom columns
🔧 fdisk / parted – Partition Tools
⚡ Require sudo and careful handling.
sudo fdisk -l # List all partitions
sudo fdisk /dev/sdb # Interactive partition tool
sudo parted -l # List partitions (more detailed)
sudo parted /dev/sda print # Show partition table
🔌 mount / umount – Mount Filesystems
mount # Show all mounted filesystems
sudo mount /dev/sdb1 /mnt/usb # Mount partition to directory
sudo umount /mnt/usb # Unmount
sudo mount -t ntfs /dev/sdb1 /mnt/usb # Specify filesystem type
sudo mount -o ro /dev/sdb1 /mnt/usb # Mount read-only
🆔 blkid – Block Device Attributes
sudo blkid # Show UUID and filesystem type
blkid -s UUID /dev/sda1 # Show only UUID
UUIDs are used in /etc/fstab for persistent mounting.
🩺 fsck – Filesystem Check
⚡ Filesystem must be unmounted.
sudo fsck /dev/sda1 # Check filesystem
sudo fsck -f /dev/sda1 # Force check even if clean
sudo fsck -y /dev/sda1 # Auto-repair (yes to all)
🔄 dd – Convert & Copy
Powerful low-level copying tool.
sudo dd if=/dev/sda of=/dev/sdb bs=4M status=progress # Clone disk
sudo dd if=/dev/zero of=/tmp/test.img bs=1M count=100 # Create 100MB test file
sudo dd if=/dev/sda of=backup.img bs=4M # Backup disk to image
sudo dd if=backup.img of=/dev/sdb bs=4M # Restore from image
10.11 Compression & Archive Commands
Create and extract compressed archives.
📦 tar – Tape Archive
Most common archiving tool.
| Operation | Command | Description |
|---|---|---|
| Create | tar -czf archive.tar.gz folder/ | Create gzipped archive |
| Extract | tar -xzf archive.tar.gz | Extract gzipped archive |
| Create | tar -cjf archive.tar.bz2 folder/ | Create bzip2 archive (smaller) |
| Extract | tar -xjf archive.tar.bz2 | Extract bzip2 archive |
| List | tar -tf archive.tar.gz | View contents without extracting |
| Extract specific | tar -xzf archive.tar.gz file.txt | Extract single file |
| Verbose | tar -xzvf archive.tar.gz | Verbose output (show files) |
Options explained: c=create, x=extract, t=list, f=file, z=gzip, j=bzip2, v=verbose
🗜️ gzip / gunzip – GNU Zip
gzip file.txt # Compress (creates file.txt.gz)
gunzip file.txt.gz # Decompress
gzip -l file.txt.gz # List compression info
zcat file.txt.gz # View compressed file
📚 zip / unzip – ZIP Archives
zip archive.zip file1.txt file2.txt # Create ZIP
zip -r archive.zip folder/ # Recursive (include subfolders)
zip -e secure.zip file.txt # Encrypt with password
unzip archive.zip # Extract ZIP
unzip -l archive.zip # List contents
unzip archive.zip -d /target/folder # Extract to directory
10.12 Search & Text Processing Commands
Find files and manipulate text data.
🔎 grep – Global Regular Expression Print
Search text using patterns.
grep "error" logfile.log # Search for string
grep -i "warning" logfile.log # Case-insensitive
grep -r "TODO" ~/project/ # Recursive search
grep -v "exclude" file.txt # Invert (lines NOT matching)
grep -c "pattern" file.txt # Count matches
grep -n "error" file.txt # Show line numbers
grep -l "config" *.conf # List only filenames
grep -A2 -B2 "error" log.txt # Show 2 lines after/before
history | grep "git" - Find git commands in history
🔍 find – Search for Files
find . -name "*.txt" # Find by name
find / -type f -size +100M # Files larger than 100MB
find ~ -type d -name "Documents" # Directories named Documents
find . -mtime -7 # Modified in last 7 days
find . -user username # Owned by specific user
find . -name "*.tmp" -delete # Find and delete
find . -name "*.py" -exec python {} \; # Execute command on each
⚡ locate – Fast File Search
locate filename # Search database (instant)
sudo updatedb # Update database
locate -i "document.pdf" # Case-insensitive
vs find: locate is faster but database may be outdated.
✂️ cut – Extract Columns
cut -d: -f1 /etc/passwd # Usernames (field 1, delimiter :)
cut -c1-5 file.txt # First 5 characters each line
cut -f2,3 -d',' data.csv # Columns 2 and 3 from CSV
📊 sort / uniq – Sort & Unique
sort file.txt # Sort alphabetically
sort -n numbers.txt # Sort numerically
sort -r file.txt # Reverse order
sort -u file.txt # Sort and unique
uniq file.txt # Remove adjacent duplicates
sort file.txt | uniq -c # Count occurrences
sort file.txt | uniq -d # Show only duplicates
📝 wc – Word Count
wc file.txt # Lines, words, bytes
wc -l file.txt # Line count
wc -w file.txt # Word count
ps aux | wc -l # Count processes
🔄 sed – Stream Editor
Find and replace text.
sed 's/old/new/' file.txt # Replace first occurrence per line
sed 's/old/new/g' file.txt # Replace all occurrences
sed -i 's/old/new/g' file.txt # Edit file in-place
sed '5d' file.txt # Delete line 5
sed '2,5d' file.txt # Delete lines 2-5
sed 's/ *$//' file.txt # Remove trailing spaces
10.13 SSH & Remote Access Commands
Securely connect to remote systems and transfer files.
🔐 ssh – Secure Shell
ssh user@hostname # Connect to remote
ssh -p 2222 user@hostname # Custom port
ssh -i ~/.ssh/id_rsa user@hostname # Use specific key
ssh -J jumpuser@jumpbox user@target # Jump host (proxy)
ssh -X user@hostname # Forward X11 (GUI apps)
ssh -L 8080:localhost:80 user@hostname # Local port forwarding
🔑 ssh-keygen – Generate SSH Keys
ssh-keygen -t rsa -b 4096 # Generate RSA key (4096 bit)
ssh-keygen -t ed25519 # Modern, more secure
ssh-keygen -f ~/.ssh/customkey # Custom filename
📤 scp / rsync – File Transfer
scp file.txt user@host:/path/ # Copy to remote
scp user@host:/path/file.txt . # Copy from remote
scp -r folder/ user@host:/path/ # Copy directory
rsync -avz source/ user@host:/dest/ # Sync with compression
rsync -av --delete source/ dest/ # Mirror (delete extras)
rsync --progress largefile user@host:/path/ # Show progress
10.14 Date, Time & Scheduling Commands
Schedule tasks and manage system time.
⏰ crontab – Scheduled Tasks
Format: minute hour day month weekday command
crontab -e # Edit crontab
crontab -l # List cron jobs
crontab -r # Remove all jobs
Examples:
0 5 * * * /script.sh | Daily at 5:00 AM |
*/15 * * * * /check.sh | Every 15 minutes |
0 0 * * 1 /weekly.sh | Every Monday at midnight |
@reboot /startup.sh | Run at system boot |
⏱️ at – One-time Scheduled Task
at 14:30 # Schedule at specific time
at now + 1 hour # One hour from now
atq # List pending jobs
atrm 5 # Remove job ID 5
👁️ watch – Execute Periodically
watch -n 2 df -h # Run df -h every 2 seconds
watch -d free -h # Highlight differences
watch 'ps aux | grep python' # Monitor Python processes
⏲️ timedatectl – System Time Control
timedatectl # Show current settings
timedatectl list-timezones # List all timezones
sudo timedatectl set-timezone America/New_York # Set timezone
sudo timedatectl set-time "2025-02-11 14:30:00" # Set date/time
sudo timedatectl set-ntp yes # Enable NTP sync
10.15 Hardware & Device Commands
View hardware information and manage devices.
🖥️ lspci – PCI Devices
lspci # List PCI devices
lspci -v # Verbose
lspci -nn # Show vendor/device IDs
lspci | grep VGA # Graphics card
lspci -s 00:02.0 -v # Specific device
🔌 lsusb – USB Devices
lsusb # List USB devices
lsusb -v # Verbose
lsusb -t # Tree view
sudo lsusb -D /dev/bus/usb/001/002 # Device descriptor
🧠 lscpu – CPU Information
lscpu # CPU architecture, cores, threads
cat /proc/cpuinfo # Detailed CPU info
nproc # Number of processing units
Shows: Architecture, CPU op-modes, CPU(s), Thread(s) per core, Core(s) per socket, Model name, CPU MHz
💾 free – Memory Usage
free -h # Human-readable
free -m # In MB
free -s 2 # Repeat every 2 seconds
vmstat 1 # Virtual memory stats
🧩 lsmod / modprobe – Kernel Modules
lsmod # List loaded modules
sudo modprobe module_name # Load module
sudo modprobe -r module_name # Remove module
modinfo module_name # Show module info
sudo depmod -a # Rebuild module dependencies
📟 dmesg – Kernel Ring Buffer
dmesg # All kernel messages
dmesg | tail -20 # Recent messages
dmesg -w # Follow (live)
dmesg -l err,warn # Errors and warnings only
Useful for: Debugging hardware issues, USB device detection, driver problems.
🖥️ xrandr – Display Settings
xrandr # List displays and resolutions
xrandr --output HDMI-1 --mode 1920x1080 # Set resolution
xrandr --output eDP-1 --brightness 0.8 # Adjust brightness
xrandr --output HDMI-1 --same-as eDP-1 # Mirror displays
xrandr --output HDMI-1 --right-of eDP-1 # Extend displays
🎧 alsamixer – Sound Settings
alsamixer # Interactive sound mixer
amixer set Master 70% # Set volume from terminal
amixer set Master mute # Mute
amixer set Master unmute # Unmute
🌡️ sensors – Temperature Monitoring
sensors # CPU/GPU temperatures
sensors -f # Fahrenheit
Install: sudo apt install lm-sensors
📚 Quick Command Reference Card
Most commonly used commands for daily Linux usage:
pwd - Current locationls -la - List all filescd ~ - Go homecd .. - Up one level
cp -r - Copy directorymv - Move/renamerm -r - Remove directorymkdir -p - Create nested
cat - Display fileless - Page throughtail -f - Follow logshead -n 20 - First 20 lines
chmod 755 - Executablechmod 644 - Read/writesudo - Admin rights
ps aux - All processeshtop - Interactivekill -9 PID - Force kill
grep -r - Search textfind . -name - Find fileslocate - Fast search
⚠️ Safety Reminder
Commands to be extremely careful with:
rm -rf / - Deletes entire system
dd if=/dev/zero of=/dev/sda - Overwrites entire disk
chmod 777 / - Makes entire system world-writable
sudo without understanding what you're running
Module 10 Complete • Essential Linux Commands Reference • Bookmark this page for daily terminal work
Kali Linux Basics – Beginner & Safety Focused
This optional module introduces Kali Linux in a safe, ethical, and beginner-friendly way. You will understand what Kali Linux is, when to use it, how to run it safely using a USB pendrive, and how to avoid legal or beginner mistakes.
⚠️ This module focuses on learning, setup, and legal awareness. It does NOT teach hacking or illegal activities.
Kali Linux.1 What Is Kali Linux & Who Should Use It
Kali Linux is a Debian-based Linux distribution developed by Offensive Security. It is designed specifically for cybersecurity testing, ethical hacking, and digital forensics.
Unlike normal Linux systems (Ubuntu, Mint), Kali Linux comes pre-installed with hundreds of security-related tools. These tools are used to test systems you own or have permission to test.
🎯 Who Should Use Kali Linux?
- Cybersecurity students
- Ethical hackers (with permission)
- Network administrators
- Security researchers
🚫 Who Should NOT Use Kali Linux?
- Normal daily computer users
- Beginners without Linux knowledge
- People looking for gaming or office work
Kali Linux.2 Is Kali Linux Legal? Important Rules
Kali Linux itself is 100% legal to download, install, and use. However, how you use it determines legality.
⚖️ Legal Usage
- Practicing on your own computer
- Learning Linux commands
- Testing your own Wi-Fi or server
- Lab platforms (TryHackMe, Hack The Box)
🚨 Illegal Usage
- Hacking websites without permission
- Attacking public Wi-Fi networks
- Breaking into accounts or systems
Kali Linux.3 Ways to Use Kali Linux (USB, Install, VM)
Kali Linux can be used in multiple ways depending on your experience and system setup.
| Method | Description | Best For |
|---|---|---|
| Live USB | Run Kali from pendrive without installing | Beginners & safe testing |
| Full Installation | Install Kali on hard disk | Advanced users |
| Virtual Machine | Run Kali inside VirtualBox | Students & labs |
Kali Linux.4 Create Kali Linux Bootable Pendrive
A bootable pendrive allows you to run Kali Linux without installing it.
🧰 Requirements
- USB drive (minimum 16GB)
- Kali Linux ISO (official)
- Rufus / BalenaEtcher
⬇️ Download Kali Linux (Official ISO Files)
Kali Linux provides different download formats depending on how you want to use it. Always download Kali Linux from official sources only.
1️⃣ Kali Linux Live USB (No Installation)
This version runs directly from a pendrive without installing Kali Linux. Note: The Live ISO is officially distributed via torrent only.
- 🔗 Official page: https://www.kali.org/get-kali/
- Download type: Live → Installer → Torrent
- Recommended for: Temporary use & safe testing
2️⃣ Kali Linux Full Installation (Direct ISO)
This ISO can be downloaded directly in a browser and used to install Kali Linux or boot from USB.
- 🔗 Direct download (official): https://kali.download/base-images/kali-2025.4/kali-linux-2025.4-installer-amd64.iso
- Best for: Beginners who want a simple setup
3️⃣ Kali Linux Virtual Machine (Easiest & Safest)
Pre-built Kali Linux virtual machines are available for VirtualBox and VMware. No ISO or USB is required.
- 🔗 Official VM downloads: https://www.kali.org/get-kali/#kali-virtual-machines
- Supported: VirtualBox, VMware
- Best for: Students & lab practice
4️⃣ Download Kali Linux ISO (Direct Link for USB)
To create a Kali Linux bootable pendrive, you need the official Kali Linux Installer ISO. This file can be downloaded directly in your browser without using torrent.
-
🔗 Kali Linux Installer ISO (AMD64 – Official)
https://archive.kali.org/kali-images/kali-2025.4/kali-linux-2025.4-installer-amd64.iso
- Bootable USB (Rufus / BalenaEtcher)
- Fresh Kali Linux installation
- Learning & practice
⚙️ Steps (Using Rufus)
- Insert USB drive
- Open Rufus
- Select Kali ISO
- Partition scheme: GPT (UEFI)
- Click Start
Kali Linux.5 Boot Kali Linux & First-Time Setup
After creating the bootable USB, you can boot Kali Linux safely.
🚀 Boot Steps
- Restart PC
- Press Boot Menu key (F12 / Esc / F9)
- Select USB device
- Choose Live System
🔧 First-Time Setup
- Set keyboard layout
- Connect Wi-Fi
- Update system (optional)