Quoting and wildcards
*matches any string in a filename.?matches one character.- Double quotes allow variable expansion. Single quotes treat the text literally.
- A space splits arguments, so quote paths that contain spaces:
cd "My Files".
Study guide · Core notes
Reference notes for everyday Linux terminal work: how the shell finds programs, how files and pipes connect, how permission bits add up, and which command to use for packages, services, networks, and disks.
How to read these notes: Items tagged Extra sit outside the everyday command set, such as legacy ifconfig and netstat. Learn the unmarked items first. New to the topic? Start with the overview for domains and a study plan.
The shell reads what you type, expands paths and wildcards, then starts a program.
| Token or command | Meaning |
|---|---|
/ | The root of the file system. An absolute path starts here. |
. | The current directory. ./script.sh runs a file in this directory if it is executable. |
.. | The parent of the current directory. |
~ | The current user's home directory, such as /home/ada. |
pwd | Prints the absolute path of the current working directory. |
cd, cd - | Changes directory. cd with no argument goes home. cd - returns to the previous directory. |
ls -l | Lists files with type, permissions, owner, group, size, and timestamp. |
echo $PATH | Shows the colon-separated list of directories the shell searches for commands. |
which, type | which prints the first executable on PATH. type also tells you if the name is a builtin, alias, or function. |
man | Opens the manual page. man ls is the first place to check flags. |
PATH vs. the current directory: The current directory is usually not on PATH. That is why ./script.sh is required for a local script, and why command not found often means the package is missing or the directory is not listed in PATH. User customizations commonly live in ~/.bashrc.
* matches any string in a filename. ? matches one character.cd "My Files".man command for the full page.command --help or command -h for a short flag list (not every command supports both).whatis command for a one-line summary from the man database.Create, copy, inspect, and locate files before you try to edit them.
| Command | What it does |
|---|---|
cp, cp -r | Copies a file. -r is required to copy a directory tree. |
mv | Moves or renames a file or directory. It does not copy. |
rm, rm -r | Deletes a file. -r deletes a directory tree. -f skips prompts; use it carefully. |
mkdir -p | Creates a directory and any missing parents. |
touch | Creates an empty file or updates the modification time of an existing one. |
ln, ln -s | ln makes a hard link. ln -s makes a symbolic link that points at another path. |
cat, less | cat prints a file. less pages through it and is better for long logs. |
head, tail -f | Shows the first or last lines. tail -f follows a log as it grows. |
grep | Prints lines that match a pattern. Useful flags: -i ignore case, -r recurse, -n line numbers, -v invert. |
find /path -name '*.log' | Walks the tree by name, type, or other tests. Quote wildcards so the shell does not expand them first. |
nano | A simple full-screen editor. vi or vim is common on servers; learn :q to leave it. |
tar -czf archive.tar.gz dir/ | Creates a gzip-compressed archive. Extract with tar -xzf archive.tar.gz. |
The shell can send a command's output to a file or to another command. This is how short one-line workflows are built.
| Operator | Effect |
|---|---|
> | Writes standard output to a file, replacing the file if it exists. |
>> | Appends standard output to a file. |
2> | Writes standard error to a file. 2>&1 merges errors into standard output. |
| | Sends the left command's output to the right command's input. |
&& | Runs the next command only if the previous one succeeded. |
|| | Runs the next command only if the previous one failed. |
tee | Copies a pipeline to both the screen and a file. |
Examples: grep -n error /var/log/syslog | less, ps aux | grep ssh, du -sh * | sort -h. A pipeline does not change the original file unless a later command writes back to it.
Every file has a mode for the owner, the group, and everyone else.
Read = 4, write = 2, execute = 1. Add the values for each of the three positions. ls -l shows the same information as letters, such as rwxr-xr-x.
| Mode | Letters | Typical use |
|---|---|---|
755 | rwxr-xr-x | Programs and directories others may enter but not write |
644 | rw-r--r-- | Regular files that others may read |
700 | rwx------ | Private directory or script, owner only |
600 | rw------- | Private file such as a key or .ssh config |
777 | rwxrwxrwx | World-writable; avoid except on purpose, and prefer a sticky bit on shared temp directories |
chmod 755 file or chmod u+x file changes the mode.chown user:group file changes owner and group. You usually need sudo.umask subtracts permissions from new files. A umask of 022 yields 644 files and 755 directories./tmp, mode 1777): users can delete only their own files.passwd is the classic example.Know which account you are, and which process is using the CPU.
| Command or file | What it does |
|---|---|
whoami, id | Prints your username, or your UID, GIDs, and group names. |
sudo command | Runs one command with root privileges, using your password and the sudoers rules. |
su, su - | Switches to another account, root by default, using that account's password. su - also loads the target user's environment. |
/etc/passwd | Account names, UIDs, home directories, and login shells. It is world-readable. |
/etc/shadow | Password hashes. Only root can read it. |
ps aux | A snapshot of processes, including user, PID, CPU, memory, and command. |
top | A live view of CPU and memory. htop is a friendlier Extra alternative if it is installed. |
kill PID, kill -9 PID | Default kill sends SIGTERM (15) and asks the process to exit. -9 is SIGKILL and cannot be caught. Try 15 first. |
sudo vs. su: sudo keeps an audit trail of who ran what and can allow only selected commands. su is a full switch to another account. On many desktop distributions the root password is not set, so sudo is the intended path.
Install software with the distribution's package manager, then manage services with systemctl.
sudo apt update
sudo apt install nginx
sudo apt upgrade
apt show nginx # package details
apt search nginx
update refreshes the package index. install adds a package. upgrade installs newer versions of packages already on the system. Searching does not need sudo.
sudo dnf install nginx sudo dnf upgrade dnf info nginx dnf search nginx sudo dnf remove nginx
dnf refreshes metadata as needed. Service package names can differ: Debian often uses apache2, while RHEL-family systems use httpd.
| systemctl command | Result |
|---|---|
systemctl status ssh | Shows whether the unit is loaded, active, enabled, and recent log lines. Debian may use ssh; some systems use sshd. |
sudo systemctl start name | Starts the service now. |
sudo systemctl stop name | Stops the service now. |
sudo systemctl restart name | Stops and starts the service. |
sudo systemctl enable name | Starts the service automatically at boot. disable reverses this. |
journalctl -u name | Shows that unit's logs. -xe jumps to recent errors. -f follows. |
Prefer ip and ss. Treat ifconfig and netstat as Extra legacy names.
| Command | What it does |
|---|---|
ip a or ip addr | Lists interfaces and IPv4/IPv6 addresses. |
ip route | Shows the routing table, including the default gateway. |
ss -tulpn | Shows listening TCP/UDP sockets and the processes that own them. |
ping host | Tests whether a host replies to ICMP echo. It does not prove a TCP service is open. |
traceroute host | Lists hops toward a destination. Some systems ship tracepath instead. |
dig example.com | Queries DNS. dig +short prints a compact answer. |
curl -I https://example.com | Fetches a URL. -I requests headers only. wget downloads to a file by default. |
ssh user@host | Encrypted remote shell on TCP port 22. Copy files with scp or rsync. |
ifconfig, netstat Extra | Legacy interface and socket tools. Use ip and ss on current distributions. |
Name resolution order: the stub resolver usually checks /etc/hosts before DNS servers listed in /etc/resolv.conf. A wrong hosts entry can override a correct public DNS answer.
Separate "how full is the file system" from "how large is this directory."
| Command or file | What it does |
|---|---|
df -h | Free space per mounted file system, in human-readable units. |
du -sh path | Disk usage of one path. Combine with sort -h to find large directories. |
lsblk | Block devices, sizes, and mount points as a tree. |
mount, umount | Attaches or detaches a file system. You cannot umount a busy mount. |
/etc/fstab | File systems mounted at boot. A bad line can delay or block startup. |
fsck | Checks and repairs a file system. Run it only when the file system is unmounted, or from rescue media. |
free -h | RAM and swap use. This is memory, not disk. |
uname -a, uptime | Kernel and architecture; how long the system has been up and the load average. |
dmesg | Kernel ring buffer: disks appearing, driver errors, and OOM kills. |
/var/log | Traditional text logs. On systemd systems, journalctl is often the first stop. |
ls -l and whether you need sudo.df -h and df -i.ls and pwd before rewriting the command.sudo runs a single command with root privileges, using your own password and the permissions in the sudoers file. su switches to another user account, root by default, and requires that account's password.
chmod 755 sets owner read + write + execute (7), and group and others read + execute (5). It is the usual mode for programs and directories that others may enter but not write.
Learn ip and ss first. ifconfig and netstat are Extra legacy tools. Some older systems still have them, but modern distributions expect ip addr and ss -tulpn.
Test what you have learned with a timed practice exam.
Scope, domains, command map, file-system layout, and a study plan for everyday Linux CLI.
Technical reference notes for the shell, files, permissions, packages, services, and networking.
40 recall cards in four decks, plus memory notes for commands and paths.
200 original questions with custom exams, explanations, and a score report by domain.
Useful companions while you study.
Generate strong random passwords with custom length, characters, symbols, and security options.
Encode text and files to Base64 or decode Base64 data with UTF-8 support.
Convert structured data between JSON and YAML with formatting and validation.
Compare two text blocks and highlight added, removed, and changed content.
NodnWebTools provides general informational, educational, and convenience resources. Calculations, conversions, estimates, and learning materials may contain errors or become outdated. Financial, tax, medical, legal, and travel information is not professional advice. Verify important results and current requirements with qualified professionals or authoritative sources. Protect sensitive files and personal information, review each tool’s privacy limitations, and use only content you are authorized to process. You are responsible for how you use and share results. Study resources are independent and do not guarantee exam success or imply certification-provider endorsement. Linux is a registered trademark of Linus Torvalds. NodnWebTools is not affiliated with, endorsed by, or sponsored by Linus Torvalds or the Linux Foundation.