Zsh — every common shell command
Default macOS shell since Catalina. Mostly bash-compatible with nicer globbing and prompts.
All seeded commands in Zsh (227)
Files (48)
- add-contentPowerShell's append-to-file cmdlet — the equivalent of bash `>>` redirection that adds content to the end of an existing file.
echo "hello" >> file.txt - basenameStrip the directory part of a path, leaving only the final filename component.
basename /var/log/syslog - catPrint file contents to standard output.
cat file.txt - command-vPOSIX way to test whether a command exists and where it resolves.
command -v python3 - copy-itemPowerShell's copy cmdlet — the cp equivalent.
cp source dest - cpCopy files and directories.
cp source dest - ddCopy and convert files at the block level — used for disk imaging, raw I/O, and filling test files.
dd if=input.bin of=output.bin bs=1M status=progress - dfReport mounted-filesystem free space and inode usage.
df -h - dirnameStrip the final filename component from a path, leaving only the directory part.
dirname /var/log/syslog - duSummarize disk usage of files and directories.
du -sh * - fileIdentify a file by its magic bytes, not its extension.
file image.bin - findLocate files by name, size, time, or other attributes.
find . -name "*.log" - get-childitemPowerShell's directory-listing cmdlet — the ls equivalent.
ls -la - get-commandPowerShell's command-introspection cmdlet — the which / type / command -v equivalent that returns rich CommandInfo objects.
whence -p jq - get-contentPowerShell's file-read cmdlet — the cat / tail equivalent.
cat file.txt - get-locationPowerShell's current-directory cmdlet — the pwd equivalent that returns a structured PathInfo object.
pwd - lessPage through a file with backward navigation and search.
less file.txt - lnCreate a hard link or symbolic link to a file or directory.
ln -s target linkname - lsList directory contents.
ls -la - lsblkList block devices (disks, partitions, LVM volumes, RAID arrays) as a tree showing size, mountpoint, and filesystem.
lsblk - md5sumPrint an MD5 hash of one or more files. Cryptographically broken — integrity-only.
md5sum file.bin - mkdirCreate a new directory.
mkdir dir - mktempCreate a uniquely-named temporary file (or directory) in a race-free way.
mktemp - moreView a file one screen at a time (basic pager).
more file.txt - mountAttach a filesystem (disk, image, network share) to a directory in the tree so its contents become accessible.
sudo mount /dev/sdb1 /mnt/data - move-itemPowerShell's move/rename cmdlet — the mv equivalent.
mv source dest - mvMove or rename files and directories.
mv source dest - new-itemPowerShell's create-file/directory cmdlet — like touch + mkdir.
touch file.txt - out-filePowerShell's pipeline-to-file cmdlet — the equivalent of bash `>` redirection that writes formatted text output to a file.
command > out.txt - readlinkPrint the target of a symbolic link, or the canonical path.
readlink -f ./symlink - realpathResolve a path to its absolute, canonical form.
realpath ./symlink - remove-itemPowerShell's delete cmdlet — the rm / rmdir / del equivalent.
rm file.txt - resolve-pathPowerShell's path-canonicalize cmdlet — the realpath equivalent.
echo ${file:A} - rmDelete files and directories.
rm file - set-contentPowerShell's verbatim file-writer cmdlet — the equivalent of bash `>` that overwrites a file with raw, unformatted content.
echo "hello" > file.txt - set-locationPowerShell's working-directory cmdlet — the cd equivalent that also navigates registry and other PowerShell providers.
cd /var/log - sha1sumPrint a SHA-1 hash of one or more files. Cryptographically broken — integrity-only.
sha1sum file.bin - sha256sumPrint a SHA-256 hash of one or more files.
sha256sum file.bin - sha512sumPrint a SHA-512 hash of one or more files — 128 hex chars, current best-practice for high-stakes integrity.
sha512sum file.bin - shasumBSD/macOS Perl wrapper that computes SHA-1 through SHA-512 hashes of files.
shasum -a 256 file.bin - statPrint a file's size, mode, owner, and timestamps.
stat file.txt - test-pathPowerShell's path-existence cmdlet — the bash [ -e ] equivalent.
[[ -e /etc/hosts ]] - touchCreate an empty file or update its modification time if it exists.
touch file.txt - treePrint a directory tree showing files and subdirectories.
tree - typeShow how a name is interpreted — builtin, function, alias, or file.
type ls - umountDetach a previously mounted filesystem from its directory in the tree, flushing pending writes first.
sudo umount /mnt/data - whereisLocate the binary, source, and manual page for a command.
whereis ls - whichLocate an executable in PATH and print its full path.
which python3
Text (46)
- awkPattern scanning and processing language for structured text.
awk '{print $1}' file - bcArbitrary-precision command-line calculator that evaluates an expression and prints the result.
echo "2 + 2" | bc - cmpByte-by-byte comparison of two files — the binary counterpart to diff.
cmp a.bin b.bin - columnFormat whitespace- or delimiter-separated input into aligned columns.
column -t -s, file.csv - commCompare two SORTED files line by line, emitting three columns: only-in-file1, only-in-file2, in-both.
comm file1.txt file2.txt - compare-objectPowerShell's set-difference cmdlet — the diff equivalent for comparing two collections of objects or text.
diff file1 file2 - convertfrom-jsonParse a JSON string into PowerShell objects you can pipe and filter.
curl -s https://api.example.com/users | jq '.[] | .name' - convertto-jsonSerialise a PowerShell object graph to a JSON string.
jq -n --arg name alice '{name: $name}' - cutExtract sections (fields or characters) from each line.
cut -d',' -f1 file.csv - diffCompare two files or directories line-by-line and report the differences.
diff file1.txt file2.txt - echoPrint arguments to standard output, separated by spaces, followed by a newline.
echo "hello world" - export-csvWrite PowerShell objects to a CSV file with a header row.
echo -e "name,age\nalice,30\nbob,25" > users.csv - grepSearch file contents for a pattern.
grep -r "pattern" . - group-objectPowerShell's grouping cmdlet — the `sort | uniq -c` equivalent that buckets items by a property and returns counts plus the underlying groups.
sort file.txt | uniq -c - headOutput the first lines of a file.
head -n 10 file - hexdumpBSD-style hexadecimal dump — flexible format strings for byte-level inspection.
hexdump -C file.bin - iconvConvert text between character encodings (UTF-8, UTF-16, Latin-1, GBK, …) with optional transliteration.
iconv -f UTF-8 -t UTF-16LE input.txt > output.txt - import-csvRead a CSV file into PowerShell objects, inferring property names from the header row.
awk -F, 'NR>1 {print $1}' users.csv - jqCommand-line JSON processor — filter, transform, and build JSON from the shell.
curl -s https://api.example.com/users | jq '.[] | .name' - measure-objectPowerShell's aggregation cmdlet — counts items and computes sum/min/max/average, similar to wc plus awk arithmetic.
wc -l file.txt - nlNumber the lines of a file (or stdin), emitting line numbers followed by each line.
nl file.txt - odDump file contents in octal, hexadecimal, decimal, or character form — for binary inspection.
od -c file.bin - pasteMerge corresponding lines of two or more files side-by-side, tab-separated by default.
paste a.txt b.txt - patchApply a unified diff to source files, transforming them in place.
patch -p1 < changes.patch - sedStream editor for filtering and transforming text.
sed 's/old/new/g' file - select-objectPowerShell's projection cmdlet — picks specific properties or the first/last N objects, like cut + head + tail combined.
command | head -n 10 - select-stringPowerShell's pattern-search cmdlet — the grep equivalent.
grep "pattern" file.txt - seqGenerate an arithmetic sequence of numbers (1, 2, 3, … N) — one per line by default.
seq 1 10 - sortSort lines of text.
sort file - sort-objectPowerShell's sort cmdlet — sorts pipeline objects by one or more properties.
command | sort -k3 -n -r - splitSplit a large file into smaller chunks by line count, byte size, or chunk count.
split -l 1000 huge.txt chunk_ - stringsExtract printable ASCII (and optionally UTF-16) sequences from binary files.
strings file.bin - tacConcatenate and print files in reverse line order.
tac file.txt - tailOutput the last lines of a file.
tail -n 10 file - teeRead stdin and write to both stdout and one or more files at once.
command | tee output.txt - trTranslate or delete characters from input.
tr 'a-z' 'A-Z' < file - uniqFilter adjacent duplicate lines.
sort file | uniq - wcCount lines, words, or bytes.
wc -l file - where-objectPowerShell's pipeline filter cmdlet — the awk/grep equivalent for filtering objects by property.
command | awk '$3 > 100' - write-hostPowerShell's host-UI writer — the coloured-banner echo that bypasses the pipeline and prints directly to the terminal.
echo "hello" - write-outputPowerShell's pipeline-emitter cmdlet — the echo equivalent that sends objects, not just text, down the pipeline.
echo "hello" - xargsBuild and execute command lines from standard input.
find . -name '*.tmp' | xargs rm - xmllintParse, validate, and query XML documents on the command line — from the libxml2 project. XPath queries, DTD/XSD validation, pretty-printing, and XInclude resolution.
xmllint --xpath "//book[@id='1']/title/text()" books.xml - xxdHexadecimal dump utility — show file contents as hex bytes plus ASCII gutter.
xxd file.bin - yesEmit a string (default "y") repeatedly until killed — used to auto-confirm interactive prompts.
yes | apt remove some-package - yqQuery, transform, and edit YAML, JSON, TOML, and XML on the command line — the jq-shaped tool for non-JSON config formats. TWO competing implementations: mikefarah/yq (Go, jq-syntax-compatible) and kislyuk/yq (Python, jq-wrapper).
yq '.spec.replicas' deployment.yaml
Shell (57)
- aliasCreate a shortcut name for a longer command line.
alias ll='ls -la' - aptInstall, upgrade, and remove packages on Debian / Ubuntu / Mint via the APT package manager — the canonical "install software" command for Debian-family Linux.
sudo apt install nginx - bang-bangHistory expansion `!!` — repeat the previous command.
!! - bang-dollarHistory expansion `!$` — last argument of the previous command.
!$ - breakExit the innermost (or N-th enclosing) loop.
for i in 1 2 3; do [[ $i = 2 ]] && break; echo $i; done - brewInstall, upgrade, and remove packages on macOS (and Linux) via Homebrew — the de-facto macOS package manager, also installable as Linuxbrew on Debian / RHEL.
brew install ripgrep - clear-hostPowerShell's terminal-clearing cmdlet — the clear / cls equivalent that wipes the visible scrollback.
clear - continueSkip to the next iteration of the innermost (or N-th enclosing) loop.
for i in 1 2 3; do [[ $i = 2 ]] && continue; echo $i; done - datePrint the current date and time, or format an arbitrary date — the surface you reach for to timestamp logs, name backup files, or compute "now minus N days".
date - declareDeclare a variable, an array, or set variable attributes.
typeset -i count=0 - dialogGenerate ncurses-style TUI widgets (menus, prompts, checkboxes, gauges, password fields) from shell scripts — capture user input as exit-code + stderr text.
dialog --inputbox "Enter your name:" 8 40 2>/tmp/result && name=$(cat /tmp/result) - double-bracket[[ ]] extended test in bash/zsh with regex and patterns.
[[ $name == "alice" ]] - envPrint the current environment variables — every `NAME=value` pair exported into the running process, plus the gateway for running a command with a modified environment.
env - evalParse and execute a string as if it were a shell command.
eval "$cmd" - execReplace the current shell with another program.
exec python script.py - exitTerminate the current shell or script with an optional exit status.
exit 0 - expectAutomate interactive command-line programs — Tcl-based scripting tool that "expects" patterns in a program's output and "sends" responses, like a programmable user.
expect -c 'spawn ssh user@host; expect "password:"; send "secret\r"; interact' - exportSet an environment variable and mark it for export to child processes.
export NAME=value - exprEvaluate an expression (POSIX arithmetic / string ops).
expr 2 + 3 - fcEdit and re-run the previous command in $EDITOR.
fc - foreach-objectPowerShell's pipeline-loop cmdlet — the xargs / while-read equivalent for running a block per object.
command | while read -r line; do echo $line; done - functionDefine a reusable named function in a shell script.
greet() { echo "hi $1"; } - get-datePowerShell's current-time and date-arithmetic cmdlet.
date - get-helpPowerShell's documentation cmdlet — the man / info equivalent that pulls help text for cmdlets, functions, and conceptual topics.
man grep - get-memberPowerShell object introspection — list properties, methods, and events on an object.
typeset -p VAR - getoptsParse short option flags inside a shell script.
while getopts "ab:c" opt; do ...; done - gpgOpenPGP encryption, signing, and key management — GnuPG.
gpg --encrypt --recipient RECIPIENT-KEY-ID file - groupsList the groups a user belongs to — controlling which files, devices, and capabilities the user can access via group permissions.
groups - historyShow previously run commands from the shell history.
history - idPrint the current user's UID, GID, and group memberships.
id - invoke-expressionPowerShell's runtime string-evaluator cmdlet — the `eval` equivalent that parses and executes a string as code. Powerful and dangerous.
eval "$cmd_string" - letBash/zsh arithmetic-evaluation builtin — assign integer expressions to variables.
let "x = y * 2" - manDisplay the manual page for a command — the canonical authoritative documentation that ships with the binary, before tutorials or Stack Overflow answers.
man grep - passwdChange a user account password — set, expire, lock, or unlock.
passwd - pipInstall, upgrade, and remove Python packages from PyPI — Python's standard package manager, identical CLI across Linux, macOS, and Windows.
pip install requests - printenvPrint the value of a specific environment variable (or all of them) — `env` without the subprocess-launching machinery, optimised for scripts that just want to read.
printenv PATH - printfPrint formatted text using C-style format specifiers like %s and %d.
printf "%s\n" "hello" - readRead a line of input into one or more shell variables interactively.
read "name?Name: " - read-hostPowerShell interactive prompt — read a string (or SecureString) from the user.
read "name?Enter name: " - returnExit a shell function with a numeric status code.
return 1 - rpmInstall, query, verify, and uninstall individual `.rpm` package files on RHEL / CentOS / Fedora / SUSE — the low-level package backend underneath yum/dnf/zypper.
sudo rpm -ivh package.rpm - setToggle shell options like errexit/xtrace and set positional parameters.
set -euo pipefail - sleepPause execution for a number of seconds.
sleep 5 - sourceLoad a script into the current shell so its definitions persist.
source ~/.zshrc - testEvaluate a conditional — file tests, string and number comparisons.
test -f /etc/hosts - timeMeasure how long a command takes to run.
time some_command - timesShow accumulated CPU time used by the shell and its children.
times - tmuxTerminal multiplexer — keep multiple shell sessions alive in one terminal, detach and reattach across SSH disconnects, and split panes for side-by-side work.
tmux new -s work - trapRun a handler when the shell receives a signal or exits.
trap 'cleanup' EXIT - typesetDeclare a variable or set its attributes (zsh canonical name).
typeset -i count=0 - ulimitRead or set the shell process's resource limits (open files, stack, memory, …).
ulimit -n 8192 - unaliasRemove an alias previously defined with alias.
unalias ll - unsetRemove a shell variable or function from the current environment.
unset FOO - waitPause until background jobs or processes finish.
wait - whoShow who is currently logged in — listing each active session with username, terminal, login time, and remote host.
who - whoamiPrint the effective username of the current process — the identity files would be created as and that permissions checks resolve against.
whoami - yumInstall, upgrade, and remove packages on RHEL / CentOS / Fedora / Amazon Linux via YUM (Yellowdog Updater, Modified) — the RPM-family package manager, succeeded by `dnf` in RHEL 8+.
sudo yum install nginx
Navigation (7)
- cdChange the current working directory.
cd /path/to/dir - dirsList the directory stack built up by pushd and popd.
dirs -v - pop-locationPowerShell's popd — return to the directory most recently pushed.
popd - popdPop the top directory off the directory stack and cd into it.
popd - push-locationPowerShell's pushd — save the current directory on a stack, then cd.
pushd /etc - pushdPush the current directory onto a stack and cd into a new one.
pushd /tmp - pwdPrint the current working directory.
pwd
Process (26)
- bgResume a stopped (Ctrl+Z’d) job and run it in the background.
bg %1 - crontabSchedule recurring commands on Unix — the user's `crontab` file lists `<minute> <hour> <day> <month> <weekday> <command>` entries that cron runs in the background.
crontab -e - disownRemove a background job from the shell's job table so it survives shell exit.
long-job &; disown - dmesgPrint the kernel ring buffer — boot-time hardware probes, device hot-plug events, OOM killer activity, and other kernel-level diagnostics that don't go to userspace logs.
dmesg -T | tail -50 - fgBring a background or stopped job to the foreground.
fg %1 - freeDisplay the system's used and free memory — total RAM, used, free, shared, buffer/cache, and swap, for quick "is this box memory-pressured" checks.
free -h - get-processPowerShell's process-listing cmdlet — the ps equivalent.
ps -ef - get-servicePowerShell's service-listing cmdlet — like systemctl or service.
launchctl list - jobsList background and stopped jobs in the current shell session.
jobs - journalctlQuery the systemd journal — the central binary log database on systemd-based Linux systems where boot logs, service stdout/stderr, and kernel ring buffer all live.
journalctl -u nginx -f - killSend a signal to a process (typically to terminate it).
kill <pid> - lsofList open files — including regular files, sockets, pipes, devices, and the processes holding them.
lsof -i :8080 - niceLaunch a process with an adjusted scheduling priority (niceness).
nice -n 10 ./long-running-job.sh - nohupRun a command immune to SIGHUP so it survives the terminal closing.
nohup long-running-cmd & - pgrepFind PIDs (and optionally command lines) of running processes by name or other attribute — the lookup half of pkill/pgrep.
pgrep firefox - pidofReturn the PID(s) of a running process by exact name — the simpler, Linux-only cousin of pgrep.
pidof firefox - pkillKill processes by name (or other attribute) without first looking up the PID.
pkill firefox - psList a snapshot of currently running processes.
ps aux - reniceChange the scheduling priority of an already-running process.
renice -n 10 -p 1234 - screenDetachable terminal multiplexer — sessions survive disconnects.
screen -S work - start-processPowerShell's process-launcher cmdlet — the equivalent of background `&` / `nohup` / `Start` for spawning detached or elevated processes.
long-task & - stop-servicePowerShell's stop-service cmdlet — like systemctl stop.
sudo launchctl bootout system/com.example.svc - straceTrace system calls and signals received by a running process — Linux's ptrace-based syscall debugger. The canonical "why did my program fail with no useful error" tool.
strace -f -e trace=openat,connect ./myprogram - systemctlControl systemd services — start, stop, enable at boot, and inspect status — on every modern Linux distro.
sudo systemctl restart nginx - topInteractive process viewer — show running processes sorted by CPU or memory, refreshed in place.
top - unamePrint kernel and OS identification — what kernel version, machine architecture, and OS family the script is running on, for portability branching.
uname -a
Network (27)
- curlTransfer data from or to a server over HTTP, HTTPS, FTP, and many other protocols.
curl https://example.com - digQuery DNS records (A, AAAA, MX, TXT) with richer output than nslookup.
dig example.com - ftpTransfer files over FTP — legacy plaintext protocol; prefer SFTP today.
ftp ftp.example.com - hostSimple DNS lookup with one-line output, simpler than dig.
host example.com - ifconfigThe legacy network interface configurator — still primary on macOS/BSD, deprecated on most Linux distros but still installed.
ifconfig - invoke-restmethodPowerShell's REST and JSON HTTP client — curl that auto-deserialises the response.
curl -s https://api.example.com/users/1 | jq - invoke-webrequestPowerShell's HTTP cmdlet — the curl / wget equivalent.
curl https://example.com - ipThe modern Linux network utility (from `iproute2`) — manages addresses, links, routes, neighbours, tunnels, and namespaces.
ip addr show - ncNetcat — read/write arbitrary TCP and UDP data. Used for port probes, one-shot listeners, file transfer, and quick socket debugging.
nc -zv host 80 - netstatShow network connections, listening ports, routing tables, and interface statistics.
ss -tunlp - nslookupQuery DNS records (A, AAAA, MX, TXT, etc.) for a hostname.
nslookup example.com - pingSend ICMP echo requests to test reachability and round-trip latency.
ping example.com - rloginRemote login — DEPRECATED unencrypted predecessor to ssh.
ssh user@host - routeDisplay and manipulate the IP routing table — the rules that decide which interface and gateway each outbound packet uses.
route -n - rshRemote shell — DEPRECATED unencrypted predecessor to ssh.
ssh user@host command - rsyncEfficient file and directory sync, transferring only changed parts.
rsync -av src/ dest/ - scpSecurely copy files between hosts over SSH.
scp local.txt user@host:/tmp/ - sftpInteractive file transfer over SSH — the secure replacement for FTP.
sftp user@host - ssSocket statistics — the modern Linux replacement for `netstat`, querying kernel sockets directly via netlink.
ss -tuln - sshOpen a secure shell on a remote host or run a remote command.
ssh user@host - ssh-keygenGenerate, inspect, and manage SSH key pairs — the asymmetric credentials used by SSH for passwordless authentication and host verification.
ssh-keygen -t ed25519 -C "[email protected]" - telnetOpen a plaintext TCP session — legacy terminal + port-probe tool.
telnet example.com 25 - test-connectionPowerShell's reachability-check cmdlet — the ping equivalent that returns structured objects and supports TCP port tests since pwsh 7.
ping -c 4 example.com - tracepathTrace the network path to a destination — listing each hop and its round-trip time, without root privileges.
tracepath google.com - traceroutePrint the route packets take to a network host — hop-by-hop, with per-hop round-trip times — by sending probes with incrementing TTL values.
traceroute google.com - wgetNon-interactive network downloader for HTTP, HTTPS, and FTP.
wget https://example.com/file.zip - whoisLook up domain registration / WHOIS records.
whois example.com
Archive (7)
- 7zCreate, extract, and inspect 7-Zip archives (.7z, .zip, .tar.gz, and 30+ other formats) with strong LZMA2 compression and AES-256 encryption.
7z x archive.7z - bzip2Compress / decompress single files using the bzip2 (BWT + Huffman) algorithm — better ratio than gzip, slower, single-threaded.
bzip2 -k file.txt - gzipCompress (or decompress) a single file in place using the DEFLATE algorithm.
gzip file - tarBundle and unbundle files into a single archive (often combined with gzip / bzip2 / xz).
tar -czf archive.tar.gz dir/ - unzipExtract files from a ZIP archive — the read side of `zip`, available on every Unix and (since Windows 10 1803) via the bundled bsdtar.
unzip archive.zip - xzCompress / decompress files using the LZMA2 algorithm — best ratio of any mainstream compressor, slow at compress, fast at decompress, multi-threaded by default.
xz -T0 -9 file.txt - zipPackage and compress files into a ZIP archive.
zip -r archive.zip dir/
Permissions (9)
- chgrpChange the group ownership of a file or directory on Unix systems.
chgrp devs file - chmodChange file mode bits (read / write / execute permissions) on Unix files.
chmod 755 file - chownChange the owner (and optionally the group) of a file or directory.
chown user file - getfaclDisplay the POSIX.1e ACL of a file or directory — the per-user / per-group grants beyond the basic owner/group/other mode bits.
getfacl file.txt - setfaclSet or modify the POSIX.1e ACL of a file or directory — grant per-user / per-group access beyond the basic owner/group/other mode bits.
setfacl -m u:alice:rwx file.txt - suSwitch to another user's identity in the current terminal — usually for becoming root or testing as a specific user.
su - alice - sudoExecute a command with another user's privileges — usually root — without logging out and back in.
sudo apt update - umaskSet or display the default permission MASK for newly-created files and directories.
umask 022 - usermodModify an existing user account — change username, home directory, shell, primary group, supplementary groups, lock / unlock the account, or set the expiration date.
sudo usermod -aG docker alice