Basic Linux Commands Every User Should Know (Comprehensive Reference Guide)
Last Updated: July 11th, 2026
Whether you are managing a dedicated cloud server, setting up a home lab, or diving into development, proficiency in the Linux command line is an essential skill. This comprehensive guide covers the foundational Linux commands every user should know, categorized logically to take you from basic navigation to file manipulation, system monitoring, and permission management.
Why Learn the Linux Command Line?
Graphical user interfaces (GUIs) are convenient, but they consume valuable system resources and are rarely available on remote servers or enterprise headless environments. The command-line interface (CLI) provides direct, lightweight, and incredibly fast interaction with your operating system. Mastering these basic utilities empowers you to troubleshoot efficiently, automate repetitive chores, and control your system with absolute precision.
Core Categories of Linux Commands
- Navigation & Directory Management: Moving through the file system and examining directory layouts.
- File Inspection & Manipulation: Creating, copying, moving, reading, and deleting files.
- Permissions & Ownership: Controlling who can read, write, or execute files and directories.
- Process & System Monitoring: Checking resource utilization, active tasks, and hardware status.
- Networking & Searching: Finding files across the system and testing network connections.
Section 1: Navigating the File System
Before doing anything, you need to know where you are and how to move around.
1. pwd (Print Working Directory)
Displays the absolute path of the directory you are currently working in:
pwd
2. ls (List Directory Contents)
Lists files and folders in the current directory. Combine it with flags like -l for a detailed view and -a to reveal hidden files (files starting with a dot):
ls -la
3. cd (Change Directory)
Switches your active directory. Typing cd ~ takes you to your home directory, and cd .. moves you one level up:
cd /var/www/html
cd ..
Section 2: Managing Files and Directories
1. mkdir (Make Directory)
Creates a brand new directory. Use the -p flag to create nested directory trees simultaneously:
mkdir -p /home/ubuntu/projects/website
2. touch
Creates an empty file or updates the timestamp of an existing file:
touch index.html
3. cp (Copy)
Copies files or directories. Use the -r (recursive) flag when copying entire directories:
cp file.txt backup.txt
cp -r /source_dir /destination_dir
4. mv (Move / Rename)
Moves files to a new location or renames them on the fly:
mv oldname.txt newname.txt
mv file.txt /var/www/html/
5. rm (Remove)
Deletes files or directories. Exercise extreme caution with rm -rf, which forcefully and recursively deletes directories without prompting for confirmation:
rm unwanted_file.txt
rm -rf old_folder/
Section 3: Inspecting File Contents
1. cat (Concatenate & Print)
Outputs the entire contents of a file directly to your terminal screen:
cat /etc/passwd
2. less
Allows scrolling through large text files page-by-page without flooding your terminal history. Press q to exit:
less /var/log/syslog
3. head and tail
Displays the first or last few lines of a file (default is 10 lines). Use the -f flag with tail to monitor logs in real-time as they update:
head -n 5 config.txt
tail -f /var/log/nginx/access.log
Section 4: Permissions and Ownership
1. chmod (Change Mode)
Modifies file access permissions for User (u), Group (g), and Others (o) using numeric values (e.g., 755 or 644):
chmod 755 script.sh
2. chown (Change Owner)
Changes the user and group ownership of a file or directory:
sudo chown jellyfin:jellyfin /media/storage
Section 5: System and Process Monitoring
1. top and htop
Provides a real-time dynamic view of running system tasks, CPU loads, and memory consumption:
top
2. df and du
df -h reports available disk space across mounted filesystems in human-readable format, while du -sh calculates storage used by a specific directory:
df -h
du -sh /var/lib/docker/
3. free
Displays total, used, and available system RAM memory:
free -h
Section 6: Searching and Networking
1. grep
Searches for specific text patterns or keywords inside files or piped command outputs:
grep "error" /var/log/syslog
2. find
Locates files and folders based on names, modification dates, or sizes across the filesystem:
find /home/ -name "*.mp4"
3. curl and ping
ping checks network connectivity to a remote host, while curl transfers data from or to a server via URL endpoints:
ping -c 4 8.8.8.8
curl -I https://example.com