Skip to content
devtoolbox.cc

Linux Command Cheatsheet

Searchable Linux command cheatsheet: files, permissions, processes, networking, grep/sed/awk, archives, systemd and SSH.

Runs locally in your browser
146 entries

Files & directories

  • List all files (including hidden) with human-readable sizes

  • Go back to the previous directory

  • Print the current working directory

  • Create nested directories (no error if they exist)

  • Copy a directory recursively

  • Copy preserving permissions, timestamps and symlinks

  • Move or rename a file or directory

  • Delete a directory and everything in it (careful!)

  • Create a symbolic link

  • Create an empty file or update its modification time

  • Show directory tree two levels deep

  • Show detailed file metadata (size, inode, times)

  • Print the absolute, resolved path of a file

  • Sync directories efficiently (local or over SSH)

Viewing files

  • Print a file

  • Page through a file (/ to search, q to quit)

  • Show the first 20 lines

  • Show the last 50 lines

  • Follow a file as it grows (live logs)

  • Count lines in a file

  • Show differences between two files in unified format

  • Detect the type of a file

  • Hex dump of a file

Permissions & ownership

  • Owner read/write, group and others read-only

  • Owner full access, others read and execute

  • Make a file executable

  • Recursive symbolic permission change

  • Change the owner and group of a file

  • Recursively set owner (and the user's login group)

  • Set default permissions mask for new files

  • Run a command as another user

  • Show access control lists (ACLs) of a file

  • Find files by name pattern

  • Files modified in the last 24 hours

  • Files larger than 100 MB

  • Find and delete matching files

  • Run a command on every found file

  • Search text recursively and show line numbers

  • List files containing a pattern (text files only)

  • Show lines that do NOT match

  • Extended regex (alternation)

  • Show the path of an executable in PATH

  • Fast search using the file database (updatedb)

Text processing

  • Replace text in a file in place

  • Print lines 10 to 20

  • Print the first column (whitespace-separated)

  • Sum the third CSV column

  • Cut fields by delimiter

  • Count occurrences of each line, most frequent first

  • Sort and remove duplicates

  • Translate characters (here: to uppercase)

  • Build commands from standard input

  • Write stdin to a file and stdout at the same time

  • Query and transform JSON

  • Align CSV/delimited output into a table

Processes

  • List all running processes

  • Top memory-consuming processes

  • Interactive process viewer

  • Friendlier interactive process viewer (if installed)

  • Find processes by name

  • Ask a process to terminate (SIGTERM)

  • Force-kill a process (SIGKILL)

  • Kill processes matching a full command line

  • Run a command in the background

  • List jobs, bring to foreground, resume in background

  • Keep a command running after logout

  • Run with lower CPU priority

  • List files opened by a process

System info

  • Kernel and architecture info

  • Distribution name and version

  • Uptime and load averages

  • Memory usage

  • Number of CPU cores

  • CPU details

  • Recent kernel messages with timestamps

  • Show environment variables

  • Set an environment variable for the session

  • Search shell command history

  • Current Unix timestamp

Disk usage

  • Free space on mounted filesystems

  • Size of each item in the current directory

  • Directory sizes one level deep, sorted

  • Interactive disk usage explorer (if installed)

  • List block devices and partitions

  • Show mounted filesystems

  • Mount a partition

Networking

  • Show network interfaces and IP addresses

  • Show the routing table

  • Show listening TCP/UDP ports and their processes

  • Fetch only HTTP response headers

  • Send a JSON POST request

  • Download a file, resuming if interrupted

  • Check reachability (4 packets)

  • Show the network path to a host

  • DNS lookup

  • Reverse DNS lookup

  • Check whether a TCP port is open

  • Inspect a TLS certificate/handshake

Archives & compression

  • Create a gzip-compressed tarball

  • Extract a .tar.gz archive

  • Extract into a specific directory

  • List contents of a tarball

  • Create a zip archive

  • Extract a zip archive into a directory

  • Compress a file, keeping the original

  • Read a gzip file without extracting

Users & groups

  • Print the current user name

  • Show user and group IDs

  • Create a user interactively (Debian/Ubuntu)

  • Add a user to a supplementary group

  • Change your password

  • Open a root login shell

  • Show who is logged in

  • Recent logins

Services (systemd)

  • Show the status of a service

  • Restart a service

  • Start a service and enable it at boot

  • List running services

  • Follow logs of a service

  • Logs from the last hour

  • Reload unit files after editing them

SSH & remote

  • Connect to a remote host

  • Connect with a custom port and key

  • Generate a new SSH key pair

  • Install your public key on a server

  • Copy a file to a remote host

  • Local port forwarding (tunnel)

  • Connect through a jump host

Package management

  • Update packages (Debian/Ubuntu)

  • Install a package (Debian/Ubuntu)

  • Search packages (Debian/Ubuntu)

  • Install a package (Fedora/RHEL)

  • Update the system (Arch)

  • Install a package (Alpine)

Shell tips

  • Redirect stdout and stderr to a file

  • Discard error output

  • Run cmd2 only if cmd1 succeeds

  • Run cmd2 only if cmd1 fails

  • Repeat the last command (e.g. sudo !!)

  • Reverse-search command history

  • Jump to start / end of the line

  • Exit code of the last command

  • Create a command alias

  • Loop over files

  • Re-run a command every 2 seconds

  • Edit scheduled jobs for the current user

About this Linux cheatsheet

A quick reference of the Linux and shell commands developers use every day, from navigating the file system to debugging services on a server. Commands work on most distributions (Ubuntu, Debian, Fedora, Arch, Alpine) unless noted.

How to use it: type into the search box to filter by command, description or topic (try port, compress or permissions), or jump to a section. Click any command to copy it.

Commands like rm -rf and kill -9 are powerful. Double-check paths and PIDs before pressing Enter.