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.

💡 Linux is not a single OS — it comes in many distributions.

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
✅ Linux gives you control. Windows gives convenience.

1.3 Linux Distributions Explained (Ubuntu, Fedora, Mint)

  • Ubuntu: Beginner-friendly, large community
  • Linux Mint: Windows-like feel
  • Fedora: Modern and developer-focused
💡 A Linux distribution = Linux kernel + desktop + software.

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.

⚠️ Beginners should start with Desktop Environments like GNOME or Cinnamon.

1.5 Linux File System Basics (/home, /etc, /var)

  • /home – Your personal files
  • /etc – System configuration
  • /var – Logs and system data
✅ Linux uses a single unified file system — no C: or D: drives.

1.6 User Files, Hidden Files & Configuration Files

Files starting with a dot (.config, .bashrc) are hidden files used for settings.

💡 Press Ctrl + H to show hidden files.

1.7 Everyday Linux Usage for Normal Users

  • Web browsing & media
  • Office work
  • Software installation via app store
  • Updates without restarting constantly
🚀 Linux is stable, fast, and perfect for daily use.

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
💡 Quick Tip: Open terminal with Ctrl + Alt + T (in most Linux distributions)
✅ Don't be intimidated! Terminal is just another way to talk to your computer - like learning a new language.

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 using
echo $SHELL
# Output example: /bin/bash

# See all available shells on your system
cat /etc/shells
⚠️ Beginner Recommendation: Start with bash - it's everywhere and has the most learning resources.
💡 Pro Tip: Your shell prompt (e.g., 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 are
pwd
# Output: /home/your_username

# 2. List files in current directory
ls
ls -la # List all files with details

# 3. Navigate to Documents folder
cd Documents
pwd # Now shows: /home/your_username/Documents

# 4. Go back home
cd ~
# OR simply: cd

# 5. Clean up the screen
clear
Success Tip: Type these commands yourself! Muscle memory is key to learning terminal.
💡 Remember: Linux is case-sensitive! DocumentsdocumentsDOCUMENTS

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 structure
mkdir my_project
cd my_project

# Create subfolders
mkdir docs images code
ls # Shows: docs images code

# Create files
touch README.txt
cd docs
touch notes.txt

# Add content to a file
echo "Project started on $(date)" > notes.txt
cat notes.txt # View the content

# Edit with nano
nano notes.txt
# Add more text, then Ctrl+X to save and exit
📝 Nano Editor Basics:
Nano Cheat Sheet:
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
Good Practice: Use meaningful names (avoid spaces - use underscores or hyphens instead)

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 FILES
cp file.txt file_backup.txt # Basic copy
cp -i file.txt file_backup.txt # Ask before overwriting
cp -r folder/ backup/ # Copy folder recursively

# MOVING/RENAMING
mv file.txt new_name.txt # Rename file
mv file.txt Documents/ # Move to folder
mv -i old.txt new.txt # Ask before overwrite

# DELETING (BE CAREFUL!)
rm file.txt # Delete single file
rm -i important.txt # ASK before deleting
rm -r old_folder/ # Delete folder with contents
rmdir empty_folder/ # Delete ONLY if empty
🛡️ Safety Aliases (Add to ~/.bashrc):
# Make commands ask before doing dangerous things
alias cp='cp -i' # Ask before overwriting copy
alias mv='mv -i' # Ask before overwriting move
alias rm='rm -i' # ASK before deleting anything

# Prevent accidental deletion of system files
alias rm='rm -I --preserve-root'
⚠️ CRITICAL WARNING: Never run rm -rf / or rm -rf /* - it will delete EVERYTHING on your system!
💡 Recovery Tip: If you accidentally delete something, check if it's in ~/.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 history
history # Shows all commands you've typed
history 10 # Show last 10 commands
!45 # Run command #45 from history
!! # Run last command again
!ls # Run last 'ls' command
Ctrl + R # Search history (reverse-i-search)
# Type to search, press Enter to run, Ctrl+C to cancel
🚀 Tab Autocomplete - Your Best Friend:
Tab Key Magic:
• 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
💡 Pro Tip: Use Ctrl + R to find commands. Type a few letters of what you remember, and it will search your history.
🎮 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 times
ls /e # Press Tab → completes to /etc/
Mastery Goal: Use Tab for everything! It's the single biggest productivity boost in terminal.

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 -la to just ll
  • 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:
# Navigation
alias home='cd ~'
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'

# Listing
alias l='ls -CF'
alias la='ls -A'
alias ll='ls -la'
alias lh='ls -lh'

# Safety first!
alias rm='rm -i' # Ask before deleting
alias cp='cp -i' # Ask before overwriting
alias mv='mv -i' # Ask before moving

# System info
alias 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 aliases
alias
# OR: alias -p

# Check specific alias
type ll
# Output: ll is aliased to `ls -la`

# Remove an alias
unalias ll

# Create separate alias file (recommended)
nano ~/.bash_aliases
# Add all aliases here, then add this to ~/.bashrc:
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
🎮 Hands-On Exercise:
# 1. Create a test alias
alias greet='echo "Hello from your alias!"'
greet # Should show greeting

# 2. Create update shortcut
alias update-system='sudo apt update && sudo apt upgrade -y'

# 3. Make it permanent
echo 'alias ll="ls -la"' >> ~/.bashrc
echo 'alias update="sudo apt update && sudo apt upgrade -y"' >> ~/.bashrc
source ~/.bashrc # Reload

# 4. Test your new powers!
ll ~/Documents
# (Might need sudo for update if not Ubuntu/Debian)
Alias Progression: Start with 2-3 aliases, add more as you discover commands you use frequently.
⚠️ Common Mistake: Aliases are user-specific. If you create a new user account, you need to set up aliases again.

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 command
Press: Ctrl + Z # Pause program (bg/fg to manage)
Press: Ctrl + D # Send EOF (may exit)

# 2. Typed wrong command?
Press: Ctrl + C # Stop it immediately
Use: history # Find correct command
Use: !! # 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 home
cd / # Go to root
cd - # Go to previous directory
🛡️ Preventive Safety Measures:
# 1. Create safety aliases in ~/.bashrc
alias rm='rm -i' # Ask before delete
alias cp='cp -i' # Ask before overwrite
alias mv='mv -i' # Ask before move

# 2. Backup important files regularly
cp important.txt important.txt.backup
# OR use version control: git init

# 3. Test commands with echo first
echo rm *.txt # Shows what WOULD be deleted
# Then remove 'echo' to actually run

# 4. Use dry-run options when available
rsync -nav source/ destination/ # -n = dry run
🎮 Practice - Making (Safe) Mistakes:
# Create a safe practice area
mkdir ~/terminal_practice
cd ~/terminal_practice
touch file1.txt file2.txt file3.txt

# Practice common scenarios
# 1. Case sensitivity
ls FILE1.TXT # Fails - wrong case
ls file1.txt # Works

# 2. Spaces in names
touch "my document.txt" # Use quotes
ls my\ document.txt # OR use backslash

# 3. Permission errors
mkdir /system_folder # Fails - need sudo
sudo mkdir /system_folder # Works with sudo

# 4. Tab completion
ls f # Completes to file
ls fi # Shows all matches

# Clean up
cd ~
rm -r terminal_practice/
Golden Rule: If you're about to run a command with rm, format, or dd - STOP. Double-check everything.
💡 Learning Mindset: Every expert was once a beginner who made mistakes. The key is to make them in a safe environment and learn from them!

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
💡 Firefox on Linux supports hardware acceleration and Wayland for better performance.

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
✅ Use 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:

  1. Check if Wi-Fi is enabled: Look for airplane mode or hardware switch
  2. Verify driver installation: Run lspci -k | grep -A 2 -i network
  3. Restart NetworkManager: sudo systemctl restart NetworkManager
  4. Check connection details: ip addr show or ifconfig
  5. Test DNS: ping 8.8.8.8 (if this works but websites don't, it's DNS)
⚠️ Some Wi-Fi cards need proprietary drivers. Use "Additional Drivers" tool on Ubuntu.

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-bluetooth
pulseaudio -k
Install Bluetooth audio support & restart PulseAudio
Connection drops frequently sudo btmgmt power off
sudo hciconfig hci0 up
Disable power saving & bring interface up
Missing Bluetooth packages sudo apt install aptitude
sudo aptitude install bluetooth
Use aptitude for better dependency handling
Bluetooth service won't start sudo /etc/init.d/bluetooth restart
service bluetooth restart
Alternative service restart commands
Bluetooth not enabled at boot sudo systemctl enable bluetooth
Check: systemctl is-enabled bluetooth
Ensure Bluetooth starts automatically
Step-by-Step Troubleshooting Guide:
  1. Check if Bluetooth adapter is detected:
    lsusb | grep -i bluetooth
    hciconfig -a
    bluetoothctl list
                                         
  2. Enable and start the service:
    sudo systemctl enable bluetooth
    sudo systemctl start bluetooth
    sudo systemctl status bluetooth
  3. Install missing packages:
    sudo apt update
    sudo apt install bluez blueman bluez-tools
    sudo apt install pulseaudio-module-bluetooth
                                         
  4. 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
                                         
💡 Pro Tip: If bluetoothctl shows "No default controller available", run:
sudo rmmod btusb then sudo modprobe btusb to reload Bluetooth drivers.
⚠️ Important: Some systems use different service management:
  • For SysV init: sudo service bluetooth restart
  • For systemd: sudo systemctl restart bluetooth
  • Check your init system: ps -p 1 -o comm=
Quick Fix Checklist:
  1. Install packages: sudo apt install bluez blueman
  2. Enable service: sudo systemctl enable --now bluetooth
  3. Check adapter: hciconfig -a
  4. 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
⚠️ Don't enable UFW without allowing SSH first if you're connecting remotely!

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:
  1. Official VPN apps: Many providers have .deb/.rpm packages
  2. NetworkManager integration: Import .ovpn files
  3. Command line: Use openvpn or wireguard tools
  4. 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
💡 WireGuard is built into Linux kernel 5.6+ for excellent performance.
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
✅ Linux + VPN = Excellent privacy combination with full control.

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.

⚠️ Important: Commands marked with ⚡ require 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.

OptionDescriptionExample
ls -lLong format (permissions, size, date)ls -l /home
ls -aShow hidden files (starting with .)ls -la
ls -hHuman-readable sizesls -lh
ls -tSort by modification timels -lt
ls -RRecursive (show subdirectories)ls -R /etc
💡 Pro tip: ls -la is the most commonly used combination.

🔄 cd – Change Directory

Purpose: Move between directories.

cd /pathGo to specific directorycd /var/log
cd ~ or cdGo to home directorycd ~
cd ..Go up one levelcd ../.. (up two levels)
cd -Go to previous directorycd -

🌳 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

⚠️ Warning: Deletion is permanent! No recycle bin in terminal.
CommandDescriptionExample
rm file.txtRemove single filerm old.txt
rm -r folderRemove directory and contentsrm -r downloads/
rm -f fileForce remove (no confirmation)rm -f log.txt
rm -rf /path⚠️ Dangerous: force recursive deleterm -rf temp/
rm -i *.txtInteractive (ask before each)rm -i *.log

📋 cp – Copy Files & Directories

cp source destCopy filecp file.txt backup.txt
cp -r dir1 dir2Copy directory recursivelycp -r /etc /etc-backup
cp -i file destInteractive (ask before overwrite)cp -i data.txt /backup/
cp -p file destPreserve permissions & timestampscp -p config.conf /etc/
cp -a source destArchive 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
💡 Symlinks break if original file is moved; hard links don't.

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.txtShow first 10 lineshead -n 20 file.txt (20 lines)
tail file.txtShow last 10 linestail -n 50 file.txt (50 lines)
tail -f logfile.logFollow mode (live updates)tail -f /var/log/syslog
tail -f -n 100 app.logFollow with initial 100 linesDebugging applications
Real-world use: 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.

📚 Permission Basics: r=4 (read), w=2 (write), x=1 (execute)
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
💡 Example: 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
⚠️ Even root cannot modify an immutable file until the flag is removed.

10.5 Process Management Commands

Monitor, control, and terminate running programs and processes.

📊 ps – Process Status

Purpose: Snapshot of current processes.

psProcesses in current shellps
ps auxAll processes (BSD syntax)ps aux | grep firefox
ps -efAll processes (standard syntax)ps -ef --forest (tree view)
ps -u usernameProcesses for specific userps -u www-data
ps -C commandProcesses by command nameps -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)

htop is better - install with sudo apt install htop

🛑 kill / pkill – Terminate Processes

SignalNumberPurposeExample
SIGTERM15Graceful termination (default)kill 1234
SIGKILL9Force kill (cannot be ignored)kill -9 1234
SIGHUP1Hangup (reload config)kill -1 1234
SIGSTOP19Pause processkill -19 1234
SIGCONT18Continue paused processkill -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
⚠️ Always try 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
💡 Use 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
✅ Essential for remote servers - your processes survive disconnection!

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
💡 Add to ~/.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
⚠️ Always use -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
✅ Use 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.

⚠️ These commands vary by distribution. This section covers Debian/Ubuntu (apt).

📦 apt – Advanced Package Tool

Modern, user-friendly package manager.

CommandDescriptionExample
sudo apt updateUpdate package listsAlways run first
sudo apt upgradeUpgrade all packagessudo apt upgrade -y
sudo apt install packageInstall packagesudo apt install vim
sudo apt remove packageRemove packagesudo apt remove firefox
sudo apt purge packageRemove + config filessudo apt purge apache2
apt search keywordSearch packagesapt search pdf editor
apt show packageShow package detailsapt show python3
apt list --installedList installed packagesapt list --installed | grep python
sudo apt autoremoveRemove unused dependenciesClean up orphaned packages
sudo apt autocleanRemove old .deb filesFree 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)
Find largest files: 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
⚠️ Partitioning can destroy data. Always backup and double-check device names.

🔌 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
⚠️ dd is called "Disk Destroyer" for a reason. One wrong device and data is gone forever.

10.11 Compression & Archive Commands

Create and extract compressed archives.

📦 tar – Tape Archive

Most common archiving tool.

OperationCommandDescription
Createtar -czf archive.tar.gz folder/Create gzipped archive
Extracttar -xzf archive.tar.gzExtract gzipped archive
Createtar -cjf archive.tar.bz2 folder/Create bzip2 archive (smaller)
Extracttar -xjf archive.tar.bz2Extract bzip2 archive
Listtar -tf archive.tar.gzView contents without extracting
Extract specifictar -xzf archive.tar.gz file.txtExtract single file
Verbosetar -xzvf archive.tar.gzVerbose 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
💡 Common pipeline: 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
rsync is better than scp for large transfers - it only transfers differences and can resume.

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.shDaily at 5:00 AM
*/15 * * * * /check.shEvery 15 minutes
0 0 * * 1 /weekly.shEvery Monday at midnight
@reboot /startup.shRun 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:

Navigation:
pwd - Current location
ls -la - List all files
cd ~ - Go home
cd .. - Up one level
File Operations:
cp -r - Copy directory
mv - Move/rename
rm -r - Remove directory
mkdir -p - Create nested
Viewing:
cat - Display file
less - Page through
tail -f - Follow logs
head -n 20 - First 20 lines
Permissions:
chmod 755 - Executable
chmod 644 - Read/write
sudo - Admin rights
Processes:
ps aux - All processes
htop - Interactive
kill -9 PID - Force kill
Search:
grep -r - Search text
find . -name - Find files
locate - 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
💡 Important: Kali Linux is a learning and testing OS, not a replacement for Windows or Ubuntu.

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
⚠️ Unauthorized hacking is a crime in most countries and can lead to jail time, fines, and permanent records.
✅ Learn Kali Linux ethically and legally — skills matter more than shortcuts.

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
💡 Recommended for beginners: Live USB or Virtual Machine

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.

⚠️ Kali Linux Live ISO does not have a direct browser download link. Torrent is the official and recommended method.
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.

💡 This installer ISO works perfectly for USB boot and learning Kali Linux.
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.

✅ Recommended for beginners: Virtual Machine or Installer ISO USB
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.

💡 This ISO works perfectly for:
  • Bootable USB (Rufus / BalenaEtcher)
  • Fresh Kali Linux installation
  • Learning & practice

⚙️ Steps (Using Rufus)

  1. Insert USB drive
  2. Open Rufus
  3. Select Kali ISO
  4. Partition scheme: GPT (UEFI)
  5. Click Start
⚠️ All data on the USB will be erased.
✅ You now have a Kali Linux bootable pendrive.

Kali Linux.5 Boot Kali Linux & First-Time Setup

After creating the bootable USB, you can boot Kali Linux safely.

🚀 Boot Steps

  1. Restart PC
  2. Press Boot Menu key (F12 / Esc / F9)
  3. Select USB device
  4. Choose Live System

🔧 First-Time Setup

  • Set keyboard layout
  • Connect Wi-Fi
  • Update system (optional)
💡 Default username: kali | password: kali
✅ Kali Linux is now ready for learning and labs.