
You do not need to memorize hundreds of commands: you need to recognize the task, find the tool, and check what it will do. This page organizes a practical selection by topic, with a safe lab and documentation references. The title refers to the booklet of more than 500 commands available at the end; the page does not reproduce the entire PDF.
Before copying: understand the type of example
The examples use Bash and tools commonly found on Linux. Some programs are optional; package and service names vary between distributions. Follow the file lab in order; the other blocks are independent queries, not a script to run in its entirety as root.
- Query: displays information but may expose paths, users, and sensitive data. Review output before sharing it.
- Local change: creates or modifies practice files. Check the current directory before running it.
- Administration: installs, removes, restarts, or changes permissions on real systems. It requires planning, authorization, and a recovery path; it should not be the first troubleshooting attempt.
Discover commands and read help
type -a ls
command -v python3
help cd
man tar
tar --help
apropos archive
Use type to discover whether a name resolves to an alias, function, or executable. Bash help covers its built-ins; man opens manual pages. Apropos searches descriptions in the manual database, which must be installed and indexed. In common pagers, q quits and the slash starts a search.
Run the following blocks in the same terminal as a regular user. You need the usual GNU tools, grep, sed, awk, tar, and diff. The working directory is new and resides under your home directory. If creating or entering it fails, the first block exits the shell instead of continuing elsewhere.
LAB_DIR=$(mktemp -d "$HOME/linux-commands.XXXXXX") || exit 1
cd "$LAB_DIR" || exit 1
pwd
mkdir -p data copies restored
printf '%s\n' 'alpha' 'beta' 'alpha' > data/words.txt
cp -i data/words.txt copies/words.txt
ls -lah
stat data/words.txt
The listing shows the created structure; stat provides file metadata. Quotes protect paths containing spaces. The interactive copy option asks for confirmation when overwriting, but it does not make every operation safe.
Read text, filter lines, and count correctly
cat data/words.txt
head -n 2 data/words.txt
tail -n 1 data/words.txt
wc -l data/words.txt
grep -n '^alpha$' data/words.txt
grep -c '^alpha$' data/words.txt
sort data/words.txt | uniq -c
sed 's/beta/gamma/' data/words.txt
awk '{print NR, $0}' data/words.txt
The file has 3 lines; the exact search for alpha finds 2. The grep count option counts selected lines, not all occurrences within a line. Sort groups equal values for uniq; the sed example changes only the output, not the original file.
For large files, prefer a pager such as less instead of dumping everything onto the screen. To edit, choose an installed editor such as nano or vi, and learn to save and quit before opening an important configuration file.
Find files without deleting anything
find data -type f -name '*.txt' -print
find data -type f -exec grep -nH 'alpha' {} +
find data -type f -mtime -1 -print
Quotes leave the filename pattern for find to interpret. Batch execution with separate arguments preserves filenames containing spaces. The time filter searches files modified within the last 24 hours; it does not necessarily mean since midnight. Inspect the selection first: a query should not contain a surprise deletion.
Permissions, ownership, and links
id
groups
chmod 640 data/words.txt
ln data/words.txt data/words-hard.txt
ln -s words.txt data/words-link.txt
ls -li data/
readlink data/words-link.txt
Permission 640 gives the owner read and write access, the group read access, and everyone else no access. The hard link shares the file inode; the symbolic link stores a path. In this lab, the temporary directory also restricts access: file bits alone do not demonstrate access by another user.
Do not solve failures by granting everyone unrestricted permissions or recursively changing a production directory tree without understanding the effects. Ownership changes, ACLs, and sudo rules should be tested in a training environment with the correct users and directories.
Archive, restore, and verify
tar -czf data.tar.gz data/
tar -tzf data.tar.gz
tar -xzf data.tar.gz -C restored
diff -r data restored/data
sha256sum data.tar.gz
List the contents before extracting and use an empty directory. The comparison should show no differences in this exercise. This checks content, not every requirement of a complete backup. A hash helps compare files but establishes origin only when checked against a trusted reference.
An archive-mode copy attempts to preserve attributes; the result depends on permissions and the filesystems involved. ACLs, extended attributes, links, and application data recovery need their own tests. Do not confuse an existing compressed archive with proven recoverability.
Pipes, redirections, and exit statuses
printf '%s\n' 'first' > output.txt
printf '%s\n' 'second' >> output.txt
cat output.txt | tee copies/output.txt
if grep -q '^alpha$' data/words.txt; then
printf '%s\n' 'Found'
else
printf '%s\n' 'Not found'
fi
Single redirection overwrites; double redirection appends. A pipe connects one command’s standard output to the next command’s input. Standard error is separate. In Bash, a pipeline’s result normally comes from its last command; scripts that need to detect earlier failures should consider pipefail and handle exit statuses deliberately.
The lab is now complete. Keep the directory path to review the results. The following sections are independent references; they do not require deleting the files you created.
Processes and performance: inspect before terminating
ps -eo pid,ppid,user,comm
pgrep -a bash
uptime
free -h
vmstat 1 5
uname -a
lscpu
These queries help distinguish processes, load, memory, and architecture. The first vmstat sample has a different time basis from later samples; do not interpret every line as equivalent measurements of the last second. A slow system requires correlation, not merely inspecting one isolated number.
Before terminating a process, identify its PID, user, and role. Normal termination allows the program to handle the request; forced termination does not provide the same cleanup opportunity. Avoid broad patterns that affect multiple processes and do not use forced termination as a universal recipe.
Disks: diagnose without formatting
df -h
df -i
du -sh "$HOME"
lsblk -f
findmnt
Compare space, inodes, directory usage, and mounts. Querying the size of your home directory may take time. Free space and inode counts are different measurements; a deleted file still open in a process can also keep space allocated.
Formatting, partitioning, and filesystem repair are excluded from this guide’s copy-and-paste blocks. Practice on an empty virtual disk, identify the device, and confirm the tool’s requirements. Do not assume that a disk name seen in a tutorial matches yours.
Networking and HTTP: address, route, socket, and response
ip -brief address
ip route
ss -ltn
ss -lun
getent hosts example.com
curl --head --max-time 10 https://example.com
curl --silent --show-error --output /dev/null --max-time 10 \
--write-out '%{http_code}\n' https://example.com
The first queries are local; name resolution and curl access external services. Seeing a listening port does not prove it is reachable from another machine. A DNS error, a missing route, and an unavailable application require different investigations.
An HTTP status code is not the same as curl’s exit status. Without an option to fail on HTTP errors, receiving an error page can still count as a successful transfer to the tool. Likewise, do not treat a missing ping reply as sufficient proof that a service is down.
Services, logs, and scheduled tasks
On systems using systemd, begin with queries. Access to some logs may be restricted; an absence of visible messages does not necessarily mean no events occurred.
systemctl --failed --no-pager
systemctl list-units --type=service --state=running --no-pager
systemctl list-timers --all --no-pager
journalctl -b -p err --no-pager
journalctl --since "1 hour ago" --no-pager
journalctl --disk-usage
crontab -l
The final query requires cron to be installed and may report that the user has no crontab. Do not confuse listing schedules with installing a task. A scheduled script needs defined paths, permissions, environment, and log destination.
When administering a service, choose one action at a time. Starting, stopping, restarting, and reloading are not synonyms; reloading depends on service support. Boot enablement is another property. After editing a unit, reloading systemd definitions does not automatically restart the application.
Packages: use your distribution’s package family
These examples query packages rather than updating them automatically. Use only the block matching your distribution. On Debian and Ubuntu:
dpkg-query -W bash
dpkg-query -L bash
apt-cache policy bash
On an RPM-based distribution with Bash installed:
rpm -q bash
rpm -ql bash
On Arch Linux with Bash installed:
pacman -Qi bash
pacman -Ql bash
Installation, removal, and updates change the system. Read the proposed transaction and your distribution’s documentation before confirming. Do not combine alternatives using slashes within a command line: that can pass unexpected arguments instead of representing a choice.
SSH and copying: verify the destination before transferring
For SSH, confirm the user, host, port, and server identity through a trusted channel. Do not accept a changed host key without investigating, and never send the private key to the server. For step-by-step instructions, use the blog’s key guide.
To practice rsync locally, return to the lab directory and use this dry run if the tool is installed:
cd "$LAB_DIR" || exit 1
rsync -ani data/ copies/data/
The dry run shows changes without copying them. A trailing slash on the source means the directory contents. Removing the dry-run option performs the transfer; deletion options can erase destination files and require separate review. Archive mode does not automatically include every kind of metadata.
Complementary tools and useful shortcuts
Tldr offers short examples, and ripgrep makes recursive searches with ignore rules convenient. They are complements, not universal replacements for manuals or traditional tools. Check each program’s installation and defaults: ignored files may not appear in a search.
In Bash’s default editing mode, Ctrl-R searches history, while Ctrl-A and Ctrl-E move to the start and end of the line. Ctrl-C interrupts the foreground task; Ctrl-Z suspends it. These are keystrokes, not commands to paste. Before repeating anything from history, read the entire line: the context and directory may have changed.
Habits that prevent accidents
- Check the user, directory, source, and destination. Use quotes and do not infer disk or server paths from an example.
- Back up before editing and validate restoration. An untested snapshot or copy does not demonstrate recoverability.
- Do not assume every command has a dry-run or interactive mode. Check the manual and read the option’s limitations.
- Avoid recursive deletions, formatting, broad permission changes, and automatic confirmation responses in generic recipes.
- Validate configurations before reloading and test the service afterward. Keep a rollback path and console access when changing networking or SSH.
- Do not paste commands from AI or unknown pages without reviewing them. Pay particular attention to downloads executed directly, redirections, and empty variables.
Historical PDF: more than 500 Linux commands
The archive retains the booklet by Bruno Andrade (GNU/Linux – Brasil), whose cover indicates 2016. The document itself permits free downloading and sharing for noncommercial purposes. It remains in Portuguese and was not rewritten in this revision; the English version of this page does not turn the PDF into a translation.
Use the booklet as a historical catalog, not as authorization to run every example on a current system. Check versions and manuals before administrative commands. The revised selection above prioritizes understanding the task and verifying results rather than copying an entire list.
Keep practicing
- LPIC-1: study plan and lab
- Linux Server Series from the archives
- wget guide
- AI terminal assistants: use with review
Choose a task, perform it in a training environment, and record how you validated it. Knowing how to consult documentation and recognize a dangerous command is more valuable than memorizing a list of names.