Quiz

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 numberLinux skill assessedQuestion typeCorrect conceptDifficulty
1Working directoryCommand purposepwdFoundational
2Listing filesCommand syntaxls -laFoundational
3Filesystem navigationPath scenarioRelative parent pathFoundational
4File permissionsPermission interpretationOwner read/write/execute; group read/executeIntermediate
5Elevated privilegesAdministration scenarioUse authorized sudo deliberatelyIntermediate
6Searching textCommand purposegrep searches file contentsFoundational
7ProcessesCommand and conceptps aux displays processes and PIDsIntermediate
8Shell pipelinesOperator scenario| connects standard output to standard inputIntermediate
9Output redirectionSyntax comparison> replaces; >> appendsFoundational
10Services and exit statusConceptual scenarioZero usually indicates successIntermediate

Questions

  1. Which command displays the current working directory in a GNU/Linux shell?

    • A. cd
    • B. pwd
    • C. whereis
    • D. dir
  2. Which command lists directory contents in long format, including hidden entries?

    • A. ls -la
    • B. ls -h
    • C. show --all
    • D. dir /hidden
  3. Your current working directory is /home/alex/projects. Which command moves to /home/alex using a relative path?

    • A. cd /home/alex/projects
    • B. cd ..
    • C. pwd ..
    • D. cd ~projects
  4. 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.
  5. 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 grep to bypass the permission check.
  6. Which command searches filename for lines containing the text pattern error?

    • A. grep 'error' filename
    • B. find 'error' filename
    • C. locate 'error' filename
    • D. search filename error
  7. On a system that supports the ps aux syntax, what does ps aux primarily 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.
  8. What does command1 | command2 do in a shell?

    • A. Saves the output of both commands to a file named command2.
    • B. Runs command2 only if command1 fails.
    • C. Sends standard output from command1 to standard input of command2.
    • D. Sends standard error from command2 to command1.
  9. Assume output.txt already contains text. What is the difference between command > output.txt and command >> 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.
  10. 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 systemctl is commonly used to inspect or manage services.
    • B. An exit status of zero always means the command failed, and ps permanently enables services.
    • C. Exit status is the same as a process ID, and grep starts services.
    • D. Services can be managed only by changing file names in the current directory.

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.

  1. Correct answer: B — pwd. The command prints the present working directory. cd changes directories; it does not display the current location by itself.

  2. Correct answer: A — ls -la. ls lists entries, -l requests long format, and -a includes hidden names beginning with a dot. Without an appropriate option, hidden entries are normally omitted.

  3. Correct answer: B — cd ... Two dots represent the parent directory, so this command moves from /home/alex/projects to /home/alex. A path beginning with / is absolute; a path such as .. is relative to the working directory.

  4. Correct answer: A. Permission bits are grouped as owner, group, and others. rwx gives the owner read, write, and execute access; r-x gives the group read and execute access; --- gives others no access. A familiar file extension does not by itself make a file executable.

  5. Correct answer: C — sudo. sudo command runs an authorized command with elevated privileges. Use administrative access only when needed rather than operating as root for ordinary work.

  6. Correct answer: A — grep 'error' filename. grep searches file contents for matching lines. Tools such as find and locate are commonly used to find files by name or location, not to search their contents.

  7. 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 aux displays a broad process listing.

  8. 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.

  9. 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.

  10. 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, systemctl is 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 rangeInterpretationRecommended review topics
9–10Strong command-line foundationContinue with process management, services, scripting, and administration practice.
7–8Good foundation with a few gapsReview permissions, paths, pipes, redirection, and the explanations for missed questions.
5–6Developing understandingPractice core commands in a terminal and revisit files, directories, users, and processes.
0–4Review needed before advancingRestart 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.