Linux Quiz 8: Multiple-Choice Knowledge Check
Take an untimed 10-question Linux quiz covering commands, paths, permissions, sudo, processes, services, pipes, redirection, and shell behavior.
This Linux quiz contains 10 multiple-choice questions covering foundational and intermediate command-line skills. It is untimed, so work at your own pace.
Choose one answer for each question unless a question explicitly says to select multiple answers. If the learning platform supports saved progress, you can leave and return later. After submission, review your answers, the correct responses, and explanations.
Begin the quiz: start with Question 1 below. Assume a GNU/Linux shell environment unless a question states a different assumption.
Key Terms for This Quiz
- Linux: an operating-system family commonly used with a command-line environment.
- Terminal: a text interface where you enter commands.
- Shell: a command interpreter, such as Bash, that runs commands.
- Command: a program or shell builtin invoked from the command line.
- Option: a command modifier, commonly introduced with a hyphen.
- Argument: a value supplied to a command, such as a file name or path.
- Path: the location of a file or directory.
- Working directory: the directory in which the current shell session is operating.
- Process: a running program identified by a process ID, or PID.
- Standard output: the normal output stream from a command.
- Standard error: the stream normally used for error messages.
- Pipe: a shell operator that sends one command's output to another command's input.
- Redirection: a shell feature that sends input or output to files or streams.
Quiz Question Blueprint
| Question number | Linux skill assessed | Question type | Correct concept | Difficulty |
|---|---|---|---|---|
| 1 | Working directory | Command purpose | pwd | Foundational |
| 2 | Listing files | Command syntax | ls -la | Foundational |
| 3 | Filesystem navigation | Path scenario | Relative parent path | Foundational |
| 4 | File permissions | Permission interpretation | Owner read/write/execute; group read/execute | Intermediate |
| 5 | Elevated privileges | Administration scenario | Use authorized sudo deliberately | Intermediate |
| 6 | Searching text | Command purpose | grep searches file contents | Foundational |
| 7 | Processes | Command and concept | ps aux displays processes and PIDs | Intermediate |
| 8 | Shell pipelines | Operator scenario | | connects standard output to standard input | Intermediate |
| 9 | Output redirection | Syntax comparison | > replaces; >> appends | Foundational |
| 10 | Services and exit status | Conceptual scenario | Zero usually indicates success | Intermediate |
Questions
Which command displays the current working directory in a GNU/Linux shell?
- A.
cd - B.
pwd - C.
whereis - D.
dir
- A.
Which command lists directory contents in long format, including hidden entries?
- A.
ls -la - B.
ls -h - C.
show --all - D.
dir /hidden
- A.
Your current working directory is
/home/alex/projects. Which command moves to/home/alexusing a relative path?- A.
cd /home/alex/projects - B.
cd .. - C.
pwd .. - D.
cd ~projects
- A.
Assume the file permission string is
-rwxr-x---. Which statement is correct?- A. The owner can read, write, and execute; the group can read and execute; others have no permissions.
- B. Everyone can read, write, and execute the file.
- C. The owner can only read the file, and the group can write it.
- D. The group has no permissions, while others can read and execute.
A command requires administrator privileges, and your account is authorized to elevate privileges. Which approach best follows least privilege?
- A. Run every command as the root user permanently.
- B. Add execute permission to the command and try again.
- C. Prefix that specific command with
sudo. - D. Use
grepto bypass the permission check.
Which command searches
filenamefor lines containing the text patternerror?- A.
grep 'error' filename - B.
find 'error' filename - C.
locate 'error' filename - D.
search filename error
- A.
On a system that supports the
ps auxsyntax, what doesps auxprimarily do?- A. Changes the current user's password.
- B. Displays a broad list of running processes, including process IDs.
- C. Searches the contents of every file for a pattern.
- D. Lists only files in the current directory.
What does
command1 | command2do in a shell?- A. Saves the output of both commands to a file named
command2. - B. Runs
command2only ifcommand1fails. - C. Sends standard output from
command1to standard input ofcommand2. - D. Sends standard error from
command2tocommand1.
- A. Saves the output of both commands to a file named
Assume
output.txtalready contains text. What is the difference betweencommand > output.txtandcommand >> output.txt?- A. Both always preserve the existing contents.
- B.
>replaces the file contents;>>appends to them. - C.
>appends;>>replaces. - D. Both send output only to standard error.
Which statement is generally correct about a command's exit status and services? Assume a system using systemd for service management.
- A. An exit status of zero generally indicates success, while
systemctlis commonly used to inspect or manage services. - B. An exit status of zero always means the command failed, and
pspermanently enables services. - C. Exit status is the same as a process ID, and
grepstarts services. - D. Services can be managed only by changing file names in the current directory.
- A. An exit status of zero generally indicates success, while
Answer Review and Explanations
Submit your answers through the quiz platform when you finish. The platform should show whether each selected response is correct. For every incorrect response, compare your selection with the correct answer below and read the explanation.
Correct answer: B —
pwd. The command prints the present working directory.cdchanges directories; it does not display the current location by itself.Correct answer: A —
ls -la.lslists entries,-lrequests long format, and-aincludes hidden names beginning with a dot. Without an appropriate option, hidden entries are normally omitted.Correct answer: B —
cd ... Two dots represent the parent directory, so this command moves from/home/alex/projectsto/home/alex. A path beginning with/is absolute; a path such as..is relative to the working directory.Correct answer: A. Permission bits are grouped as owner, group, and others.
rwxgives the owner read, write, and execute access;r-xgives the group read and execute access;---gives others no access. A familiar file extension does not by itself make a file executable.Correct answer: C —
sudo.sudo commandruns an authorized command with elevated privileges. Use administrative access only when needed rather than operating as root for ordinary work.Correct answer: A —
grep 'error' filename.grepsearches file contents for matching lines. Tools such asfindandlocateare commonly used to find files by name or location, not to search their contents.Correct answer: B — a process list. A process is a running program, and its PID identifies that running instance. On systems supporting this syntax,
ps auxdisplays a broad process listing.Correct answer: C. The pipe connects processes: standard output from the command on the left becomes standard input for the command on the right. A pipe does not save output to a file; redirection performs that task.
Correct answer: B. The single greater-than operator,
>, redirects standard output and replaces existing file contents. The double operator,>>, redirects standard output while preserving existing contents and adding new output.Correct answer: A. A zero exit status generally indicates that a command completed successfully; nonzero values commonly indicate an error or another condition. With systemd,
systemctlis commonly used to inspect and manage services. Service commands may require appropriate permissions.
Scoring
Count one point for each correct answer. Your final score is the number correct out of 10. The result is a knowledge check, not a timed performance measure.
| Score range | Interpretation | Recommended review topics |
|---|---|---|
| 9–10 | Strong command-line foundation | Continue with process management, services, scripting, and administration practice. |
| 7–8 | Good foundation with a few gaps | Review permissions, paths, pipes, redirection, and the explanations for missed questions. |
| 5–6 | Developing understanding | Practice core commands in a terminal and revisit files, directories, users, and processes. |
| 0–4 | Review needed before advancing | Restart with command syntax, filesystem navigation, permissions, and basic shell behavior. |
Next Steps
If you missed a question, reproduce the relevant command in a safe practice directory and observe its output. Pay particular attention to the difference between commands that display information and commands that change the shell state, the distinction between content searches and file searches, and the difference between pipes and redirection.
For additional practice, review Linux Quiz 7, revisit Linux Quiz 6, or work through earlier checks such as Linux Quiz 5, Linux Quiz 4, Linux Quiz 2, and Linux Quiz 1.