Linux command reference by distribution

Choose Ubuntu, Debian, Fedora or CentOS Stream and search common Linux commands by purpose, with examples, options and permissions.

A reference to common commands, not every Linux command. Examples target GNU tools, Bash and systemd on typical installations; some tools need installation and versions can differ.

Choose a distribution first. Search and category filters narrow only that distribution’s commands.

Shared commands for browsing

Enable JavaScript for distribution selection and search; the shared commands below remain readable.

pwd

Show the current directory before working with files.

pwd
  • -P: Resolve symbolic links.
  • -L: Use the shell logical path.

Command documentation

ls

List files and directories, including details or hidden entries.

ls -lah
  • -l: Show permissions, owner and size.
  • -a: Include dot-prefixed names.
  • -h: Human-readable sizes in long listings.

Command documentation

cd

Change the working directory in the current shell.

cd ~/Documents
  • ..: Parent directory; a path, not a flag.
  • -: Return to the previous directory.
  • -P: Use physical directory paths.

Command documentation

mkdir

Create a directory or a missing directory hierarchy.

mkdir -p ~/mira-practice/notes
  • -p: Create missing parents and accept existing directories.
  • -v: Report created directories.

Command documentation

touch

Create a missing empty file or update an existing file timestamp.

touch ~/mira-practice/notes.txt
  • -c: Do not create missing files.
  • -m: Update modification time only.

Command documentation

cp

Copy files or directories while keeping the original.

cp -i notes.txt notes-copy.txt
  • -i: Ask before overwriting.
  • -r: Copy directories recursively.
  • -a: Archive copy preserving attributes where possible.

Command documentation

mv

Move or rename a file; the destination might already exist.

mv -i notes-copy.txt notes-old.txt
  • -i: Ask before overwriting.
  • -v: Report moved entries.

Command documentation

rm

Remove a file; terminal removal normally bypasses the desktop trash.

rm -i notes-old.txt
  • -i: Ask before removing.
  • -r: Recursively remove a directory; review the path carefully.

Command documentation

rmdir

Remove an empty directory; a nonempty directory is refused.

rmdir empty-practice
  • -p: Also try to remove empty parents.
  • -v: Report removed directories.

Command documentation

cat

Display or concatenate text files.

cat notes.txt
  • -n: Number output lines.
  • -A: Reveal nonprinting characters.

Command documentation

less

Read a long file with scrolling and search; press q to quit.

less notes.txt
  • -N: Show line numbers.
  • -S: Scroll horizontally instead of wrapping.

Command documentation

head

Read the beginning of a text file.

head -n 10 notes.txt
  • -n 10: Show the first ten lines.
  • -c 100: Show the first hundred bytes.

Command documentation

tail

Read the end of a file or follow new log entries.

tail -n 20 notes.txt
  • -n 20: Show the last twenty lines.
  • -f: Follow appended data; stop with Ctrl+C.

Command documentation

wc

Count lines, words and bytes in a file.

wc -l notes.txt
  • -l: Count newline characters.
  • -w: Count words.
  • -c: Count bytes.

Command documentation

sort

Sort input lines without changing the original by default.

sort notes.txt
  • -n: Sort numerically.
  • -r: Reverse the ordering.

Command documentation

uniq

Report or collapse adjacent repeated lines.

uniq -c sorted-notes.txt
  • -c: Count each adjacent group.
  • -d: Show duplicate groups only.

Command documentation

grep

Find matching lines inside text files.

grep -n -i "error" notes.txt
  • -i: Ignore letter case.
  • -n: Show line numbers.
  • -F: Treat the pattern as a fixed string.

Command documentation

find

Find entries by name or type beneath a chosen directory.

find ~/mira-practice -type f -name "*.txt"
  • -name: Match a quoted filename pattern.
  • -type f: Match regular files only.
  • -maxdepth 2: Limit traversal depth in GNU find.

Command documentation

stat

Inspect file size, timestamps and permissions.

stat notes.txt
  • -c: Choose an output format in GNU stat.
  • -L: Follow symbolic links.

Command documentation

chmod

Change permissions on a file you own using the access actually needed.

chmod u+x practice.sh
  • u+x: Add owner execute permission; a mode, not a flag.
  • -v: Report processed files.
  • -c: Report changed permissions.

Command documentation

chown

Change a file owner or group, normally with administrator rights.

sudo chown "$USER":"$(id -gn)" practice.txt
  • -v: Report processed files.
  • --reference=FILE: Use a reference file owner and group.

Command documentation

id

Show user and group identifiers and memberships.

id
  • -u: Print only the user ID.
  • -gn: Print the primary group name.

Command documentation

whoami

Show the effective user name.

whoami
  • --help: Show GNU whoami help.
  • --version: Show the tool version.

Command documentation

sudo

Run a command with permissions allowed by the system policy.

sudo -l
  • -l: List permissions granted to your account.
  • -k: Invalidate cached authentication.

Command documentation

uname

Show kernel information, not the distribution name by itself.

uname -r
  • -r: Show the kernel release.
  • -m: Show machine architecture.

Command documentation

cat /etc/os-release

Read the distribution name and version from its identification file.

cat /etc/os-release
  • ID: Distribution identifier in the file, not a command flag.
  • VERSION_ID: Version identifier when supplied by the distribution.

Command documentation

date

Show the date and time using the current system settings.

date -Is
  • -I: ISO date; -Is includes time to seconds.
  • -u: Use UTC.

Command documentation

uptime

Show time since boot and load averages.

uptime
  • -p: Pretty-print uptime.
  • -s: Show boot time.

Command documentation

free

Inspect RAM and swap; consider available memory, not just free.

free -h
  • -h: Human-readable units.
  • -s 2: Repeat every two seconds.

Command documentation

df

Show mounted filesystem space, not the size of each directory.

df -h
  • -h: Human-readable units.
  • -T: Include filesystem type.

Command documentation

du

Estimate space used by files and directories.

du -sh ~/mira-practice
  • -s: Show a summary.
  • -h: Use human-readable units.

Command documentation

ps

Take a snapshot of running processes.

ps -ef
  • -e: Select all processes.
  • -f: Use full-format output.

Command documentation

top

Monitor processes and resource use interactively; q quits.

top
  • -p PID: Monitor a known process ID.
  • -d 2: Refresh every two seconds.

Command documentation

kill

Send a signal to a process you own; normal termination permits cleanup.

kill -TERM PID
  • -TERM: Request graceful termination.
  • -l: List signal names.

Command documentation

systemctl

Inspect systemd services; starting or stopping them changes the system.

systemctl status NetworkManager
  • --type=service: Filter service units when listing.
  • --user: Address the user service manager.

Command documentation

journalctl

Read systemd logs by unit or boot.

journalctl -b -n 30
  • -b: Limit to the current boot.
  • -u UNIT: Filter by unit.
  • -n 30: Show the last thirty entries.

Command documentation

ip

Inspect Linux addresses and routes using iproute2.

ip -brief address
  • -brief: Brief address output.
  • route: Routing table; a subcommand, not a flag.

Command documentation

ss

Inspect local sockets; a listening port is not proof of external reachability.

ss -lnt
  • -l: Listening sockets.
  • -n: Show numeric addresses and ports.
  • -t: Select TCP sockets.

Command documentation

ping

Send ICMP echo requests; no reply alone does not prove an internet outage.

ping -c 4 1.1.1.1
  • -c 4: Send four requests then stop.
  • -n: Use numeric addresses.

Command documentation

curl

Transfer data from a URL or inspect response headers.

curl -I https://example.com
  • -I: Request headers using HEAD.
  • -L: Follow redirects.
  • --fail: Treat HTTP error responses as failures.

Command documentation

tar

Create, inspect or extract an archive; archiving is not always compression.

tar -tf practice.tar
  • -t: List archive contents.
  • -f FILE: Specify the archive file.
  • -x: Extract; inspect contents first.

Command documentation

sha256sum

Calculate a SHA256 digest to compare with a trusted publisher value.

sha256sum download.iso
  • -c FILE: Verify against a trusted checksum file.
  • --status: Suppress output during verification.

Command documentation

man

Open an installed manual page; q quits.

man ls
  • -k WORD: Search indexed manual descriptions.
  • -f NAME: Show short descriptions.

Command documentation

command

Identify how the shell resolves a command before using it.

command -v ls
  • -v: Show how a name resolves.
  • -V: Show a more descriptive Bash result.

Command documentation