Linux commands

Linux Commands

Practical, example-driven tutorials for the Linux commands you use every day — permissions, text processing, networking, and system administration.

Command reference

Master the Linux command line, one command at a time

Each guide explains what the command does, its most useful options, and real examples you can run on Ubuntu and other distributions.

File & Directory

File & Directory

chmod Command in Linux: Permissions Guide

Master Linux file permissions with chmod — symbolic and numeric modes, recursive changes, and common examples.

Read article
File & Directory

chown Command in Linux Explained

Change file and directory ownership in Linux with chown — users, groups, recursive use, and practical examples.

Read article
File & Directory

ls Command in Linux: List Files and Options

List files and directories in Linux with ls — long format, hidden files, sorting, sizes, and recursive listing explained.

Read article
File & Directory

cp and mv Commands in Linux Explained

Copy and move files in Linux with cp and mv — recursive copies, safe overwrite prompts, preserving attributes, and renaming.

Read article
File & Directory

mkdir Command in Linux: Create Directories

Create directories in Linux with mkdir — parent directories with -p, set permissions on creation, and make many folders at once.

Read article
File & Directory

cat Command in Linux: View and Join Files

View, create, and join files in Linux with cat — number lines, reveal hidden characters, and concatenate files using redirection.

Read article
File & Directory

find Command in Linux: Search Files and Folders

Search files and directories in Linux with find — match by name, type, size, modification time, and run actions on results with -exec.

Read article
File & Directory

tar Command in Linux: Compress and Extract

Create and extract archives in Linux with tar — gzip and bzip2 compression, listing contents, and extracting to a chosen directory.

Read article
File & Directory

Symlinks in Linux: The ln Command Explained

Create symbolic and hard links in Linux with ln — understand the difference, update existing links, and apply real symlink examples.

Read article
File & Directory

touch Command in Linux: Create and Update Files

Create empty files and update timestamps with touch — make many files at once, set access and modification times, and more.

Read article
File & Directory

head and tail Commands in Linux Explained

View the beginning and end of files with head and tail — show N lines, follow logs live with tail -f, and use them in pipelines.

Read article
File & Directory

less and more: View Files Page by Page

View large files page by page with less and more — scroll, search, follow logs, and learn why less is the pager to use.

Read article
File & Directory

wc Command in Linux: Count Lines and Words

Count lines, words, characters, and bytes with wc — across one or many files, or piped output from other commands.

Read article
File & Directory

stat Command in Linux: File Metadata

View detailed file metadata with stat — size, permissions, owner, inode, and the three timestamps, with custom formats.

Read article
File & Directory

file Command in Linux: Identify File Types

Identify file types with file — detect the real type by content, not extension, check encoding, and inspect many files at once.

Read article
File & Directory

tree Command in Linux: Show Directory Trees

Display directory structures as a tree with tree — limit depth, show hidden files and sizes, and filter directories or patterns.

Read article
File & Directory

pwd Command in Linux: Print Working Directory

Print the current working directory with pwd — understand logical vs physical paths through symlinks and use it in scripts.

Read article
File & Directory

basename and dirname Commands Explained

Split file paths in scripts with basename and dirname — extract the filename or directory and strip extensions reliably.

Read article
File & Directory

rename Command in Linux: Batch Rename Files

Batch rename files with rename — change extensions, replace text in names, and preview changes safely with patterns.

Read article
File & Directory

split Command in Linux: Split Large Files

Break large files into smaller pieces with split — by size or line count, with custom suffixes, and reassemble using cat.

Read article
File & Directory

shred Command in Linux: Securely Delete Files

Securely delete files with shred by overwriting their data — control passes, remove after shredding, and know its limits.

Read article

Text Processing

Text Processing

grep Command in Linux: Search Text Fast

Search text in files with grep — case-insensitive and recursive matching, line numbers, counts, context, and regular expressions.

Read article
Text Processing

sed Command in Linux Explained with Examples

Edit text streams with sed — find and replace, in-place file edits, delete or print specific lines, and regex-powered transformations.

Read article
Text Processing

awk Command in Linux: Text Processing Guide

Process columnar text with awk — print and reorder fields, filter rows by condition, compute totals, and use BEGIN and END blocks.

Read article
Text Processing

echo Command in Linux Explained

Print text and variables in Linux with echo — escape sequences, no-newline output, and writing to files using redirection.

Read article
Text Processing

sort Command in Linux: Sort Text and Data

Sort lines of text and data with sort — alphabetical, numeric, reverse, by column, and with duplicate removal.

Read article
Text Processing

uniq Command in Linux: Filter Duplicate Lines

Filter duplicate lines with uniq — count occurrences, show only repeated or only unique lines, and pair it with sort.

Read article
Text Processing

cut Command in Linux: Extract Columns

Extract columns and fields from text with cut — by delimiter, character position, or byte, ideal for CSVs and logs.

Read article
Text Processing

tr Command in Linux: Translate Characters

Translate, squeeze, and delete characters with tr — change case, strip or replace characters, and clean text in pipelines.

Read article
Text Processing

xargs Command in Linux: Build Command Lines

Build and run commands from input with xargs — process lists safely, run per-item commands, and pair with find for batch jobs.

Read article
Text Processing

tee Command in Linux: Split Output to Files

Split output to the screen and files at once with tee — append, write privileged files with sudo, and log while watching.

Read article
Text Processing

diff Command in Linux: Compare Files

Compare files line by line with diff — unified and side-by-side output, directory comparison, and whitespace-insensitive diffs.

Read article
Text Processing

paste Command in Linux: Merge Lines of Files

Merge lines of files side by side with paste — combine columns, set a delimiter, and join lines into single rows.

Read article
Text Processing

comm Command in Linux: Compare Sorted Files

Compare two sorted files with comm — find lines unique to each or common to both, and suppress columns for set operations.

Read article
Text Processing

column Command in Linux: Format into Columns

Format text into neat aligned columns with column — turn CSV and command output into readable tables with a chosen delimiter.

Read article
Text Processing

nl Command in Linux: Number Lines

Number the lines of a file with nl — number all or only non-blank lines, and control the format and separator precisely.

Read article

Compression & Archiving

Users & Permissions

Users & Permissions

sudo Command in Linux: Run as Another User

Run commands with elevated privileges using sudo — execute as root or another user, edit sudoers safely, and stay least-privilege.

Read article
Users & Permissions

useradd / adduser: Create Users in Linux

Create users in Linux with useradd and adduser — set home directory, shell, and groups, and understand the difference between them.

Read article
Users & Permissions

passwd Command in Linux: Manage Passwords

Manage user passwords with passwd — change your own or another user's, lock and unlock accounts, and set expiry policies.

Read article
Users & Permissions

su Command in Linux: Switch User

Switch to another user with su — become root or another account, start a login shell, and understand how su differs from sudo.

Read article
Users & Permissions

usermod Command in Linux: Modify Users

Modify user accounts with usermod — add users to groups, change home directory, shell, or username, and lock accounts.

Read article
Users & Permissions

groupadd and groups: Manage Linux Groups

Create and inspect groups with groupadd and groups — make groups, view memberships, add or remove users, and delete groups.

Read article
Users & Permissions

umask Command in Linux: Default Permissions

Control default file permissions with umask — understand how it masks the base mode, common values, and how to set it permanently.

Read article
Users & Permissions

setfacl and getfacl: Linux Access Control Lists

Manage Access Control Lists with setfacl and getfacl — grant per-user and per-group permissions beyond the basic owner model.

Read article

Package Management

Networking & Transfer

Networking & Transfer

SSH Command in Linux: Connect to Remote Servers

Connect securely to remote servers with ssh — custom ports, key-based login, running remote commands, and SSH tunnelling.

Read article
Networking & Transfer

scp Command in Linux: Copy Files Over SSH

Copy files between local and remote machines over SSH with scp — recursive transfers, custom ports, key files, and attribute preservation.

Read article
Networking & Transfer

rsync Command in Linux: Sync and Backup Files

Sync and back up files with rsync — archive mode, compression, progress, mirror with --delete, and safe dry runs over SSH or locally.

Read article
Networking & Transfer

curl Command in Linux: Practical Examples

Transfer data and test APIs with curl — download files, follow redirects, send headers and POST data, and authenticate requests.

Read article
Networking & Transfer

wget Command in Linux: Download Files

Download files from the web with wget — resume interrupted transfers, mirror sites recursively, limit bandwidth, and run in the background.

Read article
Networking & Transfer

ip Command in Linux: Network Configuration

Manage networking with the ip command — show addresses, interfaces, and routes, and bring links up or down. The modern ifconfig replacement.

Read article
Networking & Transfer

ss and netstat: Check Network Connections

Inspect network connections with ss (and netstat) — list listening ports, find the process using a port, and view socket statistics.

Read article
Networking & Transfer

ping Command in Linux: Test Connectivity

Test network connectivity with ping — send a set number of packets, adjust interval and size, and read results to diagnose issues.

Read article
Networking & Transfer

dig Command in Linux: DNS Lookups

Perform DNS lookups with dig — query A, MX, TXT, and NS records, use a specific resolver, and trace resolution to debug DNS.

Read article
Networking & Transfer

netcat (nc) Command in Linux Explained

Use netcat (nc) to test open ports, transfer files between machines, run simple listeners, and debug network services.

Read article
Networking & Transfer

ufw Command in Linux: Configure the Firewall

Configure the Ubuntu firewall with ufw — enable safely, allow and deny ports and services, set defaults, and check status.

Read article
Networking & Transfer

traceroute Command in Linux: Trace Network Paths

Trace the path packets take to a host with traceroute — see each hop and its latency, and find where a connection slows or fails.

Read article
Networking & Transfer

nslookup Command in Linux: Query DNS

Query DNS records with nslookup — look up A, MX, and other records, use a specific server, and do reverse lookups.

Read article
Networking & Transfer

iptables Command in Linux: Firewall Rules

Manage Linux firewall rules with iptables — understand chains, allow and block traffic, list rules, and save them persistently.

Read article
Networking & Transfer

hostname Command in Linux: View and Set Hostname

View and set the system hostname with hostname — show the short or fully qualified name and IP, and set it permanently.

Read article
Networking & Transfer

nmap Command in Linux: Scan Networks and Ports

Scan networks and ports with nmap — discover hosts, find open ports, and detect services to audit your own systems.

Read article

Disk & Filesystem

Disk & Filesystem

mount and umount Commands in Linux

Attach and detach filesystems with mount and umount — mount drives and USB devices, list mounts, and persist them via fstab.

Read article
Disk & Filesystem

lsblk Command in Linux: List Block Devices

List disks and partitions with lsblk — view sizes, mount points, filesystems, and UUIDs in a clear tree for storage work.

Read article
Disk & Filesystem

dd Command in Linux: Copy and Image Disks

Copy and image disks with dd — write ISOs to USB, clone drives, back up partitions, and monitor progress, used carefully.

Read article
Disk & Filesystem

fdisk Command in Linux: Partition Disks

Partition disks with fdisk — list, create, and delete partitions interactively, and write changes carefully to avoid data loss.

Read article
Disk & Filesystem

fsck Command in Linux: Check and Repair Filesystems

Check and repair filesystems with fsck — run it on unmounted disks, fix errors automatically, and schedule a boot-time check.

Read article
Disk & Filesystem

mkfs Command in Linux: Create Filesystems

Create filesystems with mkfs — format a partition as ext4, xfs, or vfat, add a label, and turn raw storage into usable space.

Read article
Disk & Filesystem

blkid Command in Linux: Identify Block Devices

Identify block devices with blkid — find partition UUIDs, filesystem types, and labels, the details needed for fstab entries.

Read article
Disk & Filesystem

parted Command in Linux: Manage Partitions

Manage partitions with parted — create GPT tables, add and resize partitions on large disks, and list layouts carefully.

Read article

Process & System

Process & System

ps and kill: Manage Processes in Linux

List and stop processes in Linux with ps and kill — find a PID, send signals, and use killall and pkill to terminate by name.

Read article
Process & System

top and htop: Monitor Linux Processes

Monitor processes live with top and htop — read CPU, memory, and load average, sort and filter, and kill processes interactively.

Read article
Process & System

systemctl Command: Manage systemd Services

Manage systemd services with systemctl — start, stop, restart, enable on boot, check status, and reload service configuration.

Read article
Process & System

journalctl: Read systemd Logs in Linux

Read systemd logs with journalctl — filter by service, follow live, show logs since boot or a time, and filter by priority level.

Read article
Process & System

Crontab in Linux: Schedule Cron Jobs

Schedule recurring tasks with crontab — edit your cron jobs, master the five time fields and special strings, and avoid common mistakes.

Read article
Process & System

df and du Commands: Check Disk Usage in Linux

Check disk usage in Linux with df and du — show free space per filesystem, find large directories, and read human-readable sizes.

Read article
Process & System

free Command in Linux: Check Memory Usage

Check memory usage with free — read total, used, free, and available RAM, understand buffers/cache, and monitor over time.

Read article
Process & System

uptime Command in Linux: Load and Run Time

See how long a system has run and its load average with uptime — read the 1, 5, and 15-minute load to judge server health.

Read article
Process & System

lsof Command in Linux: List Open Files

List open files and the processes using them with lsof — find what holds a port, file, or mount, and free busy devices.

Read article
Process & System

uname Command in Linux: System Information

Display system information with uname — kernel name and version, architecture, and hostname, in one quick command.

Read article
Process & System

nohup Command in Linux: Keep Processes Running

Keep processes running after logout with nohup — run long jobs in the background, redirect output, and detach from the terminal.

Read article
Process & System

watch Command in Linux: Run Commands Repeatedly

Run a command repeatedly and watch its output update with watch — set the interval, highlight changes, and monitor live.

Read article
Process & System

nice and renice: Set Process Priority

Set process priority with nice and renice — start or adjust a process's niceness to balance CPU between heavy and important jobs.

Read article
Process & System

jobs, bg, and fg: Manage Background Jobs

Manage background jobs with jobs, bg, and fg — suspend with Ctrl+Z, resume in background or foreground, and juggle tasks.

Read article
Process & System

dmesg Command in Linux: Kernel Messages

Read kernel messages with dmesg — view boot and hardware logs, follow live, filter by level, and diagnose device issues.

Read article
Process & System

date Command in Linux: Show and Set the Date

Show and format the date and time with date — custom formats, timestamps for filenames, date arithmetic, and setting the clock.

Read article
Process & System

vmstat Command in Linux: System Performance

Monitor system performance with vmstat — read CPU, memory, swap, and I/O statistics and spot bottlenecks at a glance.

Read article
Process & System

sysctl Command in Linux: Kernel Parameters

View and change kernel parameters at runtime with sysctl — tune networking and memory, and persist changes via sysctl.conf.

Read article
Process & System

at Command in Linux: Schedule One-Off Jobs

Schedule one-off jobs with at — run a command once at a specific time, list and remove pending jobs, complementing cron.

Read article

Editors

Shell & Help

Shell & Help

history Command in Linux: Reuse Commands

View and reuse past commands with history — rerun by number, reverse-search, clear history, and control how much bash remembers.

Read article
Shell & Help

man Command in Linux: Read Manual Pages

Read manual pages with man — navigate and search within a page, understand the manual sections, and find built-in help fast.

Read article
Shell & Help

which, whereis, and type: Locate Commands

Locate commands and executables with which, whereis, and type — find a command's path, sources, and whether it is an alias or built-in.

Read article
Shell & Help

alias Command in Linux: Create Shortcuts

Create handy command shortcuts with alias — define and list them, make them permanent in bashrc, and remove them safely.

Read article
Shell & Help

export Command in Linux: Environment Variables

Set environment variables with export — pass them to child processes, extend PATH, list the environment, and persist them.

Read article
Shell & Help

source Command in Linux: Run Scripts in the Shell

Run a script in the current shell with source — reload bashrc, load variables and functions, and keep their effects.

Read article
Shell & Help

sleep Command in Linux: Pause Execution

Pause execution for a set time with sleep — delay in seconds, minutes, or hours, and use it in scripts and retry loops.

Read article
Shell & Help

read Command in Linux: Read User Input

Read user input in scripts with read — prompt for values, hide passwords, set timeouts, and read files line by line.

Read article