Intro to Linux,
one command at a time.
A quiet, animated walkthrough of the shell — cd, ls, grep, sudo and the rest. Tap any card to re-run its demo.
The commands
203 of 203 shown · tap any card to replay
Navigation
NAVpwd
NAVpwdPrint the current working directory.
cd
NAVcd <path>Change directory. `cd ..` up, `cd ~` home, `cd -` previous.
pushd
NAVpushd <path>Push a directory onto the stack and cd into it.
popd
NAVpopdPop the directory stack, returning to the previous location.
tree
NAVtree -L 2Recursive, indented directory listing.
ls -R
NAVls -R <dir>Recursively list every file below a directory.
cd -
NAVcd -Jump back to the previous working directory.
dirs
NAVdirs -vShow the current directory stack, numbered.
cd ~
NAVcd ~Jump to the current user's home directory.
Files & directories
FSls
FSls [-lah] [path]List directory contents. `-l` long, `-a` hidden, `-h` human.
dir
FSdirList files (DOS-friendly alias of `ls`).
mkdir
FSmkdir [-p] <dir>Create directories. `-p` makes parents as needed.
rmdir
FSrmdir <dir>Remove an empty directory.
rm
FSrm [-rf] <path>Remove files. `-r` recursive, `-f` force. Care.
cp
FScp [-r] <src> <dst>Copy files or directories.
mv
FSmv <src> <dst>Move or rename files.
touch
FStouch <file>Create an empty file or update its timestamp.
ln
FSln -s <target> <link>Create a symbolic link.
stat
FSstat <file>Detailed file metadata: size, inode, mode, times.
file
FSfile <path>Identify a file's type by content, not extension.
basename
FSbasename <path>Strip directory and suffix from a path.
dirname
FSdirname <path>Return the directory portion of a path.
realpath
FSrealpath <path>Resolve a path to its canonical absolute form.
rename
FSrename <expr> <files>Rename many files with a pattern.
shred
FSshred -u <file>Overwrite and remove a file to hinder recovery.
install
FSinstall -m 755 <src> <dst>Copy files and set mode in one shot.
readlink
FSreadlink -f <path>Print resolved value of a symbolic link.
truncate
FStruncate -s <size> <file>Shrink or extend a file to an exact size.
md5sum
FSmd5sum <file>Compute and print an MD5 hash.
sha256sum
FSsha256sum <file>Compute and print a SHA-256 hash.
chattr
FSsudo chattr +i <file>Change ext filesystem attributes (e.g. +i = immutable).
lsattr
FSlsattr <file>List ext filesystem attributes on a file.
dd
FSdd if=<in> of=<out> bs=<n>Convert and copy raw data blocks. Careful — no undo.
cmp
FScmp <a> <b>Byte-by-byte compare two files.
mktemp
FSmktempSafely create a unique temporary file or directory.
Reading files
VIEWcat
VIEWcat <file>Concatenate and print file content.
less
VIEWless <file>Page through a file. `q` quit, `/` search.
more
VIEWmore <file>Simple pager. Space for next page, `q` to quit.
head
VIEWhead -n <N> <file>Show the first N lines of a file.
tail
VIEWtail -f <file>Show the last lines. `-f` follows new writes.
tac
VIEWtac <file>Concatenate and print files in reverse.
nl
VIEWnl <file>Number the lines of a file.
echo
VIEWecho <text>Print text or variables to stdout.
diff
VIEWdiff <a> <b>Compare files line by line.
hexdump
VIEWhexdump -C <file>Canonical hex + ASCII view of any file.
xxd
VIEWxxd <file>Make a hex dump — or reverse one back to bytes.
od
VIEWod -c <file>Octal / character dump of a file.
bat
VIEWbat <file>Syntax-highlighted, git-aware `cat` clone.
strings
VIEWstrings <file>Print sequences of printable characters from a binary.
printf
VIEWprintf <fmt> <args>Formatted output — like C's printf, but from the shell.
vim
VIEWvim <file>Modal editor. `i` insert, `Esc` normal, `:wq` save+quit.
nano
VIEWnano <file>Friendly terminal editor. `Ctrl-O` save, `Ctrl-X` quit.
Search & locate
FINDgrep
FINDgrep [-rni] <pat> <path>Search text using patterns. `-r` recurse, `-i` case, `-n` lines.
find
FINDfind <path> -name <glob>Walk a directory tree looking for matches.
which
FINDwhich <cmd>Locate a command in your PATH.
whereis
FINDwhereis <cmd>Locate binary, source, and manual for a command.
locate
FINDlocate <name>Quickly find files by name via the updatedb index.
type
FINDtype <cmd>Reveal how the shell will interpret a command.
rg
FINDrg <pat> <path>Ripgrep — blazing recursive text search.
fd
FINDfd <pattern>Simple, fast alternative to `find`.
ag
FINDag <pat>The Silver Searcher: fast code search.
Processes
PROCps
PROCps auxSnapshot of running processes.
top
PROCtopLive process viewer.
htop
PROChtopFriendlier, colorful process viewer with mouse support.
kill
PROCkill [-9] <pid>Send a signal to a process. `-9` = SIGKILL.
killall
PROCkillall <name>Kill processes by name.
pgrep
PROCpgrep <name>Print PIDs matching a name.
nohup
PROCnohup <cmd> &Run a command immune to hangups, output to nohup.out.
jobs
PROCjobsList jobs in the current shell.
bg / fg
PROCbg %1 | fg %1Move a job to background or foreground.
systemctl
PROCsystemctl <action> <unit>Control systemd services and units.
crontab
PROCcrontab -eEdit the current user's scheduled jobs.
pkill
PROCpkill <name>Signal processes by name pattern.
renice
PROCrenice <n> -p <pid>Change scheduling priority of a running process.
nice
PROCnice -n <n> <cmd>Run a command with adjusted scheduling priority.
at
PROCat <time>Queue a one-shot job for later execution.
watch
PROCwatch -n <s> <cmd>Re-run a command at intervals and show output.
time
PROCtime <cmd>Report how long a command took to run.
timeout
PROCtimeout <dur> <cmd>Run a command with a wall-clock kill switch.
wait
PROCwait [pid]Block until background jobs / a PID finish.
trap
PROCtrap '<cmd>' <signal>Run a handler when the shell receives a signal.
Network
NETping
NETping <host>Send ICMP echo requests.
curl
NETcurl [-X M] <url>Transfer data from or to a URL.
wget
NETwget <url>Download files non-interactively.
ssh
NETssh user@hostOpen a secure shell session.
scp
NETscp <src> user@host:<dst>Copy files over SSH.
rsync
NETrsync -avz <src> <dst>Efficient incremental file sync, local or remote.
ss
NETss -tulpnInspect open sockets and listeners (modern netstat).
ip
NETip <object> <cmd>Show and manipulate routing, devices, and tunnels.
traceroute
NETtraceroute <host>Trace the network path packets take to a host.
dig
NETdig <domain>DNS lookup utility. Query records directly.
nc
NETnc [-lv] <host> <port>Netcat: read/write TCP & UDP. Swiss-army knife.
netstat
NETnetstat -tulpnLegacy socket inspector. Prefer `ss`.
ifconfig
NETifconfigLegacy interface config tool. Prefer `ip`.
arp
NETarp -aShow or manipulate the ARP cache.
nslookup
NETnslookup <host>Query DNS interactively.
host
NEThost <domain>Simple DNS lookup utility.
iptables
NETsudo iptables -LConfigure kernel packet filtering rules.
ufw
NETsudo ufw <cmd>Uncomplicated firewall front-end for iptables.
tcpdump
NETsudo tcpdump -i <if>Capture and analyse network packets.
nmap
NETnmap <host>Network scanner — hosts, ports, services.
mtr
NETmtr <host>Live traceroute + ping in one continuously updating view.
whois
NETwhois <domain>Look up domain registration info.
ftp
NETftp <host>Interactive File Transfer Protocol client.
sftp
NETsftp user@hostInteractive file transfer over SSH.
iwconfig
NETiwconfigShow wireless interface configuration.
nmcli
NETnmcli <object> <cmd>Command-line control of NetworkManager.
Permissions
PERMchmod
PERMchmod <mode> <file>Change file permissions. `755`, `+x`, `o-w` …
chown
PERMchown user:group <file>Change file ownership.
chgrp
PERMchgrp <group> <file>Change the group ownership of a file.
umask
PERMumask <mask>Set the default permission mask for new files.
sudo
PERMsudo <cmd>Execute a command as the superuser. Power. Responsibility.
su
PERMsu [- user]Switch user. `su -` loads target user's env.
passwd
PERMpasswd [user]Change a user's password.
id
PERMid [user]Show user and group IDs.
getfacl
PERMgetfacl <file>Show POSIX ACLs on a file.
setfacl
PERMsetfacl -m u:op:rw <f>Modify POSIX ACLs on a file.
sudoers
PERMsudo visudoSafely edit /etc/sudoers with syntax checking.
useradd
PERMsudo useradd <name>Create a new user account.
usermod
PERMsudo usermod -aG <g> <u>Modify a user account (add groups, shell, home).
groups
PERMgroups [user]Show the groups a user belongs to.
userdel
PERMsudo userdel <name>Delete a user account.
groupadd
PERMsudo groupadd <name>Create a new group.
chage
PERMsudo chage -l <user>Show or change password expiration policy.
System
SYSuname
SYSuname -aPrint system and kernel information.
df
SYSdf -hDisk space usage by filesystem.
du
SYSdu -sh <path>Disk usage of a path. `-s` summary, `-h` human.
free
SYSfree -hMemory usage at a glance.
uptime
SYSuptimeHow long the system has been up.
whoami
SYSwhoamiPrint the effective user.
history
SYShistoryShow recently executed commands.
man
SYSman <cmd>The manual. Your most reliable contact.
date
SYSdate [+fmt]Print or set the system date.
hostname
SYShostnameShow or set the system's hostname.
lsblk
SYSlsblkList block devices in a tree.
dmesg
SYSdmesg -TPrint or control the kernel ring buffer.
journalctl
SYSjournalctl -u <unit>Query the systemd journal.
mount
SYSmount <dev> <dir>Attach a filesystem to a mount point.
reboot
SYSrebootRestart the system.
shutdown
SYSshutdown -h nowPower off or halt the system.
env
SYSenvPrint or set environment variables.
export
SYSexport KEY=valueSet an env var for child processes.
alias
SYSalias ll='ls -lah'Create a shortcut for a longer command.
clear
SYSclearWipe the visible terminal buffer. `Ctrl-L` too.
exit
SYSexitClose the current shell session.
lscpu
SYSlscpuDisplay CPU architecture information.
lsusb
SYSlsusbList USB devices attached to the system.
lspci
SYSlspciList PCI devices on the bus.
lsof
SYSlsof -i :<port>List open files and the processes that hold them.
uptime -p
SYSuptime -pPretty-print how long the system has been up.
who
SYSwhoShow who is logged on.
last
SYSlast -n <N>Show the last logged-in users.
timedatectl
SYStimedatectlShow and change system time / timezone.
hostnamectl
SYShostnamectlQuery or change the system hostname and metadata.
loginctl
SYSloginctl list-sessionsInspect systemd-logind sessions.
sysctl
SYSsudo sysctl <var>Read or write kernel runtime parameters.
modprobe
SYSsudo modprobe <mod>Load a kernel module (with its dependencies).
lsmod
SYSlsmodShow the status of loaded kernel modules.
uname -r
SYSuname -rPrint the running kernel release string.
swapon
SYSswapon --showShow or enable swap devices and files.
fdisk
SYSsudo fdisk -lPartition table manipulator for block devices.
blkid
SYSblkidShow block-device UUID, label, and filesystem type.
systemctl list-units
SYSsystemctl list-units --type=serviceList units systemd currently knows about.
shutdown -c
SYSshutdown -cCancel a pending scheduled shutdown.
Packages
PKGapt
PKGsudo apt install <pkg>Debian/Ubuntu package manager.
dnf
PKGsudo dnf install <pkg>Fedora/RHEL package manager.
pacman
PKGsudo pacman -S <pkg>Arch package manager.
snap
PKGsudo snap install <pkg>Cross-distro sandboxed package manager.
brew
PKGbrew install <pkg>Homebrew: user-space package manager.
dpkg
PKGdpkg -i <file.deb>Low-level Debian package tool.
apt update
PKGsudo apt updateRefresh available package lists.
apt upgrade
PKGsudo apt upgradeInstall newer versions of installed packages.
rpm
PKGrpm -qaQuery and manage RPM packages directly.
yay
PKGyay -S <pkg>AUR helper for Arch — like pacman + AUR builds.
pip
PKGpip install <pkg>Install Python packages from PyPI.
npm
PKGnpm install <pkg>Install Node.js packages from the registry.
flatpak
PKGflatpak install <pkg>Install and run sandboxed desktop apps.
Text & streams
TEXTtar
TEXTtar -czvf out.tgz <dir>Archive files. `-x` extract, `-t` list.
wc
TEXTwc -l <file>Count lines, words, bytes.
sort
TEXTsort <file>Sort lines of text.
uniq
TEXTuniq [-c]Filter adjacent duplicate lines. Pair with sort.
awk
TEXTawk '{ print $1 }'Pattern-scanning and processing language.
sed
TEXTsed 's/foo/bar/g'Stream editor for transforming text.
xargs
TEXT<cmd> | xargs <cmd>Build and execute commands from stdin.
cut
TEXTcut -d, -f2 <file>Extract sections from each line.
tr
TEXTtr <set1> <set2>Translate or delete characters.
tee
TEXT<cmd> | tee <file>Read stdin, write to stdout AND to files.
jq
TEXTjq '.path' <file>Sling JSON on the command line.
column
TEXTcolumn -t <file>Format text into columns.
paste
TEXTpaste <a> <b>Merge lines of files side by side.
fold
TEXTfold -w <N>Wrap each input line to fit a given width.
rev
TEXTrev <file>Reverse the characters of each line.
split
TEXTsplit -l <N> <file>Split a file into fixed-size pieces.
yes
TEXTyes [string]Repeatedly print a string until killed (feeds `y` to prompts).
expand
TEXTexpand <file>Convert tab characters to spaces.
unexpand
TEXTunexpand <file>Convert leading spaces back to tabs.
comm
TEXTcomm <a> <b>Line-by-line compare two sorted files.
join
TEXTjoin <a> <b>Join two sorted files on a common field.
zip
TEXTzip <out.zip> <files>Compress files into a .zip archive.
unzip
TEXTunzip <archive.zip>Extract files from a .zip archive.
gzip
TEXTgzip <file>Compress a file to .gz (removes the original).
gunzip
TEXTgunzip <file.gz>Decompress a .gz file back to the original.
base64
TEXTbase64 [-d] <file>Encode / decode data as Base64.