Linux Fundamentals and Command-Line Operations
The Linux Fundamentals and Command-Line Operations domain tests whether you can navigate a Linux system, find and inspect files, and combine small commands into reliable pipelines. Expect questions on the Filesystem Hierarchy Standard (FHS), shell quoting and globbing, text-processing tools, redirection, and exit statuses.
Filesystem landmarks
- /etc holds host-specific configuration; /var holds variable data such as logs and spools; /usr holds read-only user utilities and libraries; /home holds user data; /tmp is world-writable and commonly cleaned at boot.
- /proc and /sys are virtual filesystems exposing kernel and process state; /dev contains device nodes; /boot holds the kernel and bootloader files.
- On modern distributions /bin, /sbin, and /lib are usually symlinks into /usr.
Command-line mechanics
- Single quotes prevent all expansion; double quotes allow variable and command substitution; a backslash escapes one character.
- Pipes connect stdout of one command to stdin of the next; 2> redirects stderr; &> redirects both; >> appends.
- $? holds the exit status of the last command; 0 means success.
Worked example
You need log files under /var/log larger than 5 MB modified in the last week. Run: find /var/log -type f -name '*.log' -size +5M -mtime -7 -exec ls -lh {} ; Reasoning: -type f excludes directories, the quoted pattern is passed to find rather than expanded by the shell, -size +5M and -mtime -7 filter by size and age, and -exec runs ls on each match. Using + instead of ; batches arguments and is faster.
Traps
- Quoting a glob when you want the shell to expand it, or leaving it unquoted when find should expand it.
- Assuming grep uses extended regex; use grep -E or egrep.
- Forgetting that rm -rf does not prompt and does not use the trash.
- Confusing a shell builtin with an external binary when using type, which, or command -v.