# === GETTING HELP === man # [#man-db] Opens the official manual page for a command (arrows to scroll, "/" to search, "q" to quit) tldr # [#tealdeer] Displays simplified examples of how to use a command --help / -h # Prints a summary of a command's usage and available flags directly in the terminal # === BASICS, NAVIGATION & FILES === pwd # Prints the absolute file path of the current working directory sudo [-u |-s|-H] # Executes a command with elevated privileges (`-u`: run as specific user; `-s`: execute shell; `-H`: set HOME to target user's home dir) ls [-la|-lh|-R|--tree] # Lists directory contents (`-l`: long format with details; `-a`: include hidden; `-h`: human-readable file sizes; `-R`: recursively list subdirectories) cd # Changes the current working directory to the specified folder path cp [-r|-i] # Copies files or directories (`-r`: recursive copy for folders; `-i`: prompt before overwriting existing files) mv [-i] # Moves or renames files and directories (`-i`: prompt before overwriting existing destination files) rm [-rf|-i] # Removes files or directories (`-rf`: delete files and folders without prompting; `-i`: prompt before every removal) mkdir [-p] # Creates a new directory (`-p`: create parent directories as needed without throwing errors if they exist) touch # Creates a new empty file or updates the access and modification timestamps of an existing one ln [-s] # Creates links between files (`-s`: creates a symbolic/soft link pointing to a path, rather than a hard link) du [-h|-s|-d ] [] # Estimates disk space usage (`-h`: human readable; `-s`: summary only; append `*` for dir items) df -h # Displays filesystem disk space usage summaries in human-readable units cat # Outputs the entire contents of a file directly to the standard output stream less # [#less] Opens a file for interactive, page-by-page viewing (use arrow keys to scroll, "/" to search, press "q" to exit) head [-n ] # Outputs the first lines of a file (defaults to 10 lines; use `-n` to specify a custom line count) tail [-n |-f] # Outputs the final lines of a file (`-n`: specify line count; `-f`: append output as the file grows, used for logs) grep [-i|-r|-E] [] # Searches for text patterns matching a regular expression (`-i`: case-insensitive; `-r`: recursive directory search; `-E`: extended regular expressions) find -name # Searches for files within a directory hierarchy based on a filename pattern which # Locates and prints the full path of the executable file associated with a given command file # Identifies the data type and format of a file, ignoring its extension wc -l # Counts and outputs the number of lines in a file basename [] # Strips path to filename (``: strips matching file extension, e.g. `.txt`) dirname # Strips filename to parent path (no common flags needed) realpath [-e|-m] # Resolves path to canonical form (`-e`: target must exist; `-m`: path can be missing) stat [-c |-f] # Displays file details (`-c`: custom output format; `-f`: display filesystem status) xargs [-I {}|-0|-n ] # Converts stdin to cmd args (`-I {}`: placeholder replacement; `-0`: null-separated input; `-n`: max args per command) # === GENERAL FLAGS=== --verbose / -v # Outputs detailed (verbose) diagnostic information and log --version / -V # Prints the version number and build information of the command --dry-run # Simulates execution without making any actual changes or writing files --force / -f # Forces the command to execute, bypassing warnings or existing file checks --quiet / -q # Suppresses all standard output and non-error messages (silent mode) --yes / -y # Automatically answers "yes" (or confirms) to # === PIPES & REDIRECTION === | # The pipe: takes the output of the left command and feeds it as input to the right command (e.g., ls -la | grep "txt") > # Redirects output to a file, overwriting any existing contents in that file >> # Redirects output to a file, appending it to the bottom without erasing existing content 2> # Redirects only standard error (stderr) to a file, leaving standard output untouched &> # Redirects both standard output (stdout) and standard error (stderr) to a file 2>&1 # Merges standard error into standard output (e.g., `cmd > file 2>&1`) &>> # Appends both standard output and standard error to the bottom of a file < # Feeds the contents of a file into a command's standard input (input redirection) - # Stream placeholder: tells a command to consume incoming stream data from stdin instead of opening a file on disk (e.g., cat file1 -) <<< "" # Here-string: passes a literal string directly into a command's standard input << # Here-doc: passes multi-line blocks of text into a command until the delimiter keyword is matched (often EOF) tee # Reads from standard input and writes to both standard output and files (use `-a` to append) echo "" # Prints a string of text to the terminal (combined with > or >> to write notes to files) # === SHELL VARIABLES & SUBSTITUTION === $? # Returns the exit status of the immediately preceding command (0 for success, non-zero for error) $$ # Expands to the process ID (PID) of the current shell session $USER / $UID # Expands to the username and numeric user ID of the currently logged-in user $HOME / $PWD # Expands to the current user's home directory and absolute working directory path $PATH # Colon-separated list of directories where the shell searches for executable command binaries $ / ${} # Expands the value of a stored shell variable (braces are useful for concatenation or defaults) $() # Command substitution: executes a command and replaces it with its standard output string $((>) # Arithmetic expansion: evaluates mathematical expressions inside the shell # === PATHS, WILDCARDS & SPECIAL CHARACTERS === ~ # Expands to the home directory of the current user (e.g., /home/username) . # Represents the current working directory in file paths .. # Represents the parent directory (one level up in the directory tree) / # Directory path separator and the absolute root directory of the file system * # Wildcard: matches any string of characters (including an empty string) in filenames ? # Wildcard: matches any single character in filenames [] # Wildcard: matches any one of the characters enclosed within the brackets (e.g., [a-z]) # === TEXT PROCESSING & FILTERING === awk '{print $}' # Pattern scanning and text processing language for fields and columns (`-F`: set field separator) sed 's///g' # Stream editor for filtering and transforming text (`-i`: edit files in-place; `g`: global replacement per line) cut [-d ] -f # Removes sections from each line of files based on delimiters (`-d`: specify delimiter; `-f`: select fields) sort [-n|-r] # Sorts lines of text files (`-n`: numeric sort; `-r`: reverse order; `-u`: output unique lines) uniq [-c] # Reports or omits repeated lines in a file (`-c`: count occurrences; `-d`: only print duplicate lines) tr # Replaces, squashes, or deletes individual characters from piped input (`-d`: delete chars; `-s`: squash duplicates) diff # Compares files line by line (`-u`: output unified diff format; `-w`: ignore white space) paste [-d |-s] # Merges text lines horizontally (`-d`: specify custom delimiter; `-s`: flatten mode, joining all lines from the input into a single row) # === TERMINAL SHORTCUTS & MOUSE BEHAVIOR === Tab # Auto-completes file, folder, and command names as you type Ctrl + C # Cancels, stops, or terminates the running command or process currently freezing the terminal Ctrl + D # Closes the current terminal session, shell tab, or exits out of programs (acts as EOF) Ctrl + R # Reverse-i-search: searches backwards through terminal command history as you type Ctrl + L # Clears the terminal screen completely (identical to typing the "clear" command) Ctrl + A (or Home) # Moves the text cursor to the beginning of the current line Ctrl + E (or End) # Moves the text cursor to the end of the current line Ctrl + U # Deletes everything from the cursor to the start of the line Ctrl + W # Deletes the word immediately to the left of the cursor Ctrl + Shift + C # Copies currently highlighted text in the terminal window to the system clipboard Ctrl + Shift + V # Pastes text from the system clipboard directly into the terminal command line Middle Mouse Click # Pastes text currently highlighted or selected in the system primary selection buffer Shift + Mouse Scroll # Scrolls terminal output history page-by-page when alternate screen buffer is not captured # === SHELL & COMMAND HISTORY === history # Displays the command history list for the current session history -c # Clears the history list by deleting all entries from the current session history file history | grep # Searches command history for a specific past command or keyword ! # Executes a specific command from the history list using its index number !! # Re-runs the immediately preceding command from shell history alias ="" # Defines a custom shortcut or alternative name for a longer shell command clear # Clears all previous terminal output from the screen exit # Closes the terminal window or disconnects the current shell session shopt -s checkwinsize # Automatically updates terminal line and column dimensions after each command if the window size changes shopt -s cdspell # Automatically corrects minor spelling errors and typos in directory names passed to cd shopt -s extglob # Enables extended regular expression pattern matching features within the shell shopt -s histappend # Appends the current session command history to the history file rather than overwriting it on exit shopt -s histverify # Loads history expansions into the readline editing buffer to review before execution # === JOB CONTROL & MULTITASKING === jobs # Lists active background jobs and their job numbers bg [%job] # Resumes a suspended job and runs it in the background fg [%job] # Brings a background or suspended job into the foreground & # Runs a command immediately in the background nohup & # Runs a background command that ignores hangup signals and keeps running after logout screen / tmux # [#tmux / #screen] Terminal multiplexers for running multiple persistent sessions in one window # === ALTERNATIVE CLI TOOLS === eza [] # [#eza] A replacement for ls featuring grid layouts, colors, and git integration bat # [#bat] A replacement for cat featuring syntax highlighting, git integration, and line numbers ripgrep (rg) # [#ripgrep] A fast, recursive line-oriented search tool designed as a grep alternative fd # [#fd] A fast alternative to the traditional find command ncdu [] # [#ncdu] An interactive TUI tool to analyze disk space usage with percentage bars (press "q" to quit) duf # [#duf] A disk usage utility with a colorful interface for monitoring storage volumes procs # [#procs] A replacement for ps that provides colorized output, search, and tree views zoxide query / z # [#zoxide] A cd command that tracks frequently used directories for fast navigation dust # [#dust] Visual replacement for du with tree-based disk usage sd # [#sd] Fast, intuitive replacement for sed doggo # [#doggo] Modern CLI DNS client replacement for dig bottom / btm # [#bottom] Graphical process/system monitor replacement for top hyperfine '' # [#hyperfine] Command-line benchmarking tool replacement for time curlie # [#curlie] HTTP client combining curl features with httpie usability delta # [#git-delta] Syntax-highlighting pager for git and diff output lazygit # [#lazygit] Terminal UI for git commands micro # [#micro] Terminal text editor with standard keybindings and mouse support zellij # [#zellij] Terminal workspace manager and alternative to tmux # === PACKAGE MANAGEMENT: PACMAN === sudo pacman -Syu # Synchronizes repository databases and updates all installed system packages sudo pacman -S # Downloads and installs a specified package along with its required dependencies sudo pacman -Syyu # Forces a complete refresh of local repository databases before performing a system update sudo pacman -R # Removes a specified package from the system while leaving its dependencies intact sudo pacman -Rs # Removes a package and cleans up orphaned dependencies that are no longer needed sudo pacman -Rns # Removes a package, unneeded dependencies, and remaining configuration files completely sudo pacman -Rnsu # Uninstalls a package, cleans up orphan dependencies, deletes config files, and updates the system sudo pacman -Rdd # Forcefully uninstalls a package without checking dependency relationships sudo pacman -Ss # Searches remote package databases for packages matching a specific keyword sudo pacman -Si # Displays package metadata and installation statistics for a repository package pacman -Q [-qe|-qt|-qi] # Queries installed packages (`-qe`: explicitly installed packages; `-qt`: orphaned packages; `-qi`: package details) sudo pacman -Sc # Removes old, uninstalled package files from the local cache to free up disk space sudo pacman -Scc # Deletes all cached package files from local storage entirely to maximize free disk space # === PACKAGE MANAGEMENT: FLATPAK === flatpak search # [#flatpak] Searches configured remote repositories for applications matching a specific keyword flatpak install # [#flatpak] Downloads and installs an application or runtime from a configured remote repository (like Flathub) flatpak uninstall # [#flatpak] Removes an installed Flatpak application or runtime from the system flatpak uninstall --unused # [#flatpak] Cleans up and removes orphaned runtimes and extensions not used by any installed app flatpak update # [#flatpak] Updates all installed Flatpak applications and runtimes to their latest versions flatpak list [--app] # [#flatpak] Lists installed packages (`--app`: only show installed GUI applications, ignoring runtimes) flatpak run # [#flatpak] Launches a Flatpak application using its full reverse-DNS identifier (e.g., org.gimp.GIMP) flatpak remotes # [#flatpak] Lists all configured remote repositories where applications and runtimes are fetched from flatpak override # [#flatpak] Modifies sandbox permissions for a specific app (consider using Flatseal for a GUI alternative) # === AUR HELPERS (YAY / PARU) === # NOTE: The AUR can have dangerous scripts, try to only install from official repositories pretty please :3 paru -Syu # [#yay or paru] Updates all official repository packages as well as installed AUR packages paru [--repo] # [#paru] Searches, downloads and installs packages (`--repo`: restrict installation to official repositories only) paru -Sc # [#yay or paru] Clears out old cached AUR build files and downloaded tarballs paru -Scc # [#yay or paru] Completely wipes all cached packages, build directories, and archives # === SYSTEM & SERVICES (SYSTEMD) === sudo systemctl start # Immediately starts a specified systemd background service unit sudo systemctl stop # Immediately stops a running systemd background service unit sudo systemctl restart # Restarts a systemd service by stopping and starting it back up sequentially sudo systemctl enable [--now] # Configures a service to start automatically at boot (`--now`: also starts the service immediately) sudo systemctl disable # Prevents a systemd service from starting automatically during system boot sudo systemctl status # Displays runtime status information, health, and recent logs for a service journalctl -u [-f] # Queries systemd journal logs for a specific service (`-f`: stream live log updates) systemctl failed # Lists all systemd service units that have encountered failures or crashed timedatectl status # Displays current system time, timezone, and NTP synchronization status localectl status # Displays current system locale, keyboard mapping, and X11 keymap settings reboot # Reboots the computer immediately poweroff # Shuts down and turns off the power to the computer immediately shutdown now # An alternative command to immediately shut down the system # === SYSTEM AUDITING & LOGS === last # Shows a listing of last logged-in users and system reboots lastb # Shows a listing of failed login attempts, useful for detecting brute-force SSH attacks w # Displays currently logged-in users, their active terminal sessions, and system load lsof [-i|-u] # Lists open files and the processes that opened them (`-i`: list network connections) dmesg [-w] # Prints or controls the kernel ring buffer to inspect hardware and driver messages (`-w`: wait/follow) journalctl [-b|-p 3|-xe] # Queries systemd logs (`-b`: since current boot; `-p 3`: errors only; `-xe`: end of log with details) strace [-p ] # Traces system calls and signals for a command or running PID to audit process behavior watch [-n ] # Executes a command periodically and displays the output fullscreen to monitor live changes tail -f /var/log/pacman.log # Monitors the Arch package manager log in real-time to audit software installations and updates # === PERMISSIONS & OWNERSHIP === sudo # Executes a single command with administrative superuser (root) privileges su [-] # Switches the current user session context (run plain "su" or "su -" to switch to root) chmod [-R] # Modifies file access permissions (`-R`: recursive; e.g., 755 for scripts, 644 for files, +x to make executable) chown [-R] : # Changes the user and group ownership of a file or directory (`-R`: apply recursively) passwd [] # Changes the password for the current user (or a specified user if run with sudo) id [] # Prints the user ID (UID), group ID (GID), and all supplementary group memberships sudo usermod -aG # Appends a user to a supplementary group (e.g., adding a user to `wheel` or `docker`) chattr [+|-]i # Modifies advanced file attributes (`+i`: makes a file immutable, preventing edits or deletion even by root) lsattr # Lists advanced file attributes (useful for checking if a file has been made immutable) umask [] # Displays or sets the default file creation permission mask for the current shell session # === NETWORKING, DNS & SSH === nmtui # Opens an interactive text-based user interface to manage network connections and wifi nmcli device status # Displays a tabular list of network interface devices and their current connection states ip a # Displays network interface configurations, hardware addresses, and local IP assignments ip link [set ] # Displays Layer 2 MAC status, or enables (up)/disables (down) a specific network interface ip route # Displays and modifies the kernel network routing table and gateway settings ip neigh # Displays the neighbor/ARP table showing IP address to MAC address mappings on the local network ifconfig [-a| ] # [#net-tools] Legacy tool for network interfaces (replaced by ip; `-a`: show all, including down) ping [-c ] # Sends ICMP echo request packets to test network connectivity (`-c`: limit packet count) traceroute # [#traceroute] Tracks the route packets take to reach a remote host, displaying hop delays tracepath # Traces the network path discovering MTU along the way (does not require root privileges) ss [-t|-u|-l|-a|-n|-p] # [#iproute2] Displays socket statistics and shows which ports a process is using (`-t`: TCP; `-u`: UDP; `-l`: listening; `-p`: processes) netstat [-t|-u|-l|-n|-p] # [#net-tools] Legacy tool showing which ports processes are using (`-t`: TCP; `-u`: UDP; `-l`: listening; `-n`: numeric; `-p`: processes) sudo tcpdump [-i ] # [#tcpdump] Captures and displays real-time network packets (`-i`: specify network interface) nmap [-p |-sV|-O|-A|-sn] # [#nmap] Scans a host (`-p`: specify ports; `-sV`: service versions; `-O`: OS detect; `-A`: aggressive; `-sn`: ping scan/host discovery) dig [@] [] # [#bind] Queries DNS records; optionally specify a server or record type (e.g., A, AAAA, MX, TXT, CNAME) nslookup # [#bind] Queries internet name servers interactively or directly to find IP addresses whois # [#whois] Queries the WHOIS database to retrieve domain registration and ownership information curl -O # Transfers data from or to a server, downloading a file using its remote filename wget [-O ] # [#wget] A non-interactive network downloader for retrieving files (`-O`: save under a custom filename) iperf3 -s [-p ] # [#iperf3] Starts a network performance server (`-p`: specify custom port) iperf3 -c [-u|-R|-P |-t ] # [#iperf3] Tests bandwidth/network performance against a server (`-u`: UDP; `-R`: reverse mode; `-P`: parallel streams; `-t`: duration) ssh [-p ] @ # Establishes an encrypted secure shell session on a remote server (`-p`: specify custom port) scp [-r] @: # Securely copies files over an SSH network connection (`-r`: recursively copy directories) # === STORAGE, DRIVES & MOUNTING === lsblk [-f] # Lists information about available block storage devices (`-f`: output filesystems and UUIDs) blkid [-s |-o ] [] # Prints filesystem types and UUIDs of block devices (`-s`: show specific tag; `-o`: custom output format) genfstab [-U|-L] # [#arch-install-scripts] Generates a fstab file for a mounted system (`-U`: use UUIDs; `-L`: use labels) mount [-t ] [-o ] # Attaches a storage filesystem from a device to a designated directory tree path umount # Detaches a currently mounted filesystem from the directory tree findmnt # Lists currently mounted filesystems in an organized, searchable tree format dd if= of= [bs=] [count=] # Converts and copies files or disk images (`if`: input file; `of`: output file; `bs`: block size; `status=progress`: show transfer progress) # === DISK PARTITIONING & FORMATTING === fdisk [-l] /dev/ # Manages partitions (`-l`: list tables; run without flags for interactive editor) parted -s /dev/ mklabel gpt # [#parted] Non-interactively creates a fresh GPT partition table on a disk parted -s /dev/ mkpart primary 0% 100% # [#parted] Non-interactively creates a single partition spanning the entire disk mkfs. [-f|-L