Technology Technology · Programming ● Easy

Linux Commands quiz

Linux command-line confidence grows from knowing what a command reads or changes before running it. This quiz covers navigation, directory listings, file operations, text search, permissions, processes, manual pages, and safer deletion habits using common GNU/Linux tools. The explanations emphasize practical command meaning and caution around destructive operations rather than shell tricks that only work in one environment.

Start the quiz
Questions
10
Time
11 min
Difficulty
● Easy
Technology · Easy

About this quiz

Most people meet the Linux terminal the same way: a tutorial says to type something, they type it, and it works — but they could not say afterwards what the command actually did. That gap is what this quiz targets. The ten questions walk through the small set of commands that make up most real terminal sessions: finding where you are with pwd, seeing what is around you with ls, moving with cd, and copying, moving, and deleting files with cp, mv, and rm.

A useful habit the questions keep returning to: before running a command, know whether it only reads the system or actually changes it. ls, pwd, and grep are safe to experiment with all day. mv and especially rm -r change things permanently, and the terminal has no undo button or recycle bin. If you can sort commands into those two buckets, you can explore confidently without fear of breaking your machine.

Score below what you hoped? That is what the explanations are for — each one tells you not just the right answer but what the command would have done. Ten minutes of reading them is a faster education than most first weeks of trial and error.

Quick info

Before you start

Best for

Beginners using a Linux terminal

Format

10 explanation-backed questions in about 11 minutes.

What you'll cover

A small map of the test

  1. 1Navigation and listings
  2. 2Copying, moving, and deleting
  3. 3Searching text
  4. 4Permissions
  5. 5Processes and documentation
Audience

Who this quiz is for

  • Beginners using a Linux terminal
  • Developers reviewing everyday GNU/Linux commands and safe file operations
Key concepts

Ideas this quiz checks

Working directory

The directory relative paths are resolved from.

Standard output

The normal stream where command results are written.

Permissions

Read, write, and execute or search access for owner, group, and others.

Score guide

How to read your score

  1. 80–100% Strong command

    You understand most of the core ideas and can use the explanations to polish smaller gaps.

  2. 50–79% Solid base

    You know part of the topic, but the missed explanations are the highest-value review material.

  3. 0–49% Review first

    Treat this as a starting map: revisit the key concepts, then retake the quiz for a cleaner signal.

After the quiz

Recommended next steps

  • Practice navigation and file operations in a disposable directory
  • Read the manual before using recursive or privileged commands
  • Predict a pipeline's input and output before running it
References

Sources and further reading

How to play

Instructions

  1. You have 11 minutes total to answer 10 multiple-choice questions.
  2. Choose an answer to lock it in. The runner immediately shows the correct answer and explanation.
  3. Use Hint when you want a nudge, or Skip to move forward without answering.
  4. Keyboard shortcuts: A-D answer, H hints, S skips, Enter/ next, and previous.
  5. No signup required. Your progress is local to this quiz session.
Every question, explained

Answer key and explanations

All 10 questions from this quiz, with the correct answer and the reasoning behind it. Take the quiz first if you want an honest score — or read straight through and use this as revision material.

  1. What does `pwd` print?

    • The current working directory pathCorrect
    • All running processes
    • File permissions
    • The current password

    Why: `pwd` prints the name of the current working directory. Knowing that location helps interpret relative paths before copying, moving, or deleting files.

  2. What does plain `ls` normally do?

    • Lists directory contentsCorrect
    • Deletes hidden files
    • Changes directory
    • Searches file text

    Why: GNU `ls` lists information about files; with no file argument it operates on the current directory. Names beginning with a dot are normally omitted unless an appropriate option is used.

    Source GNU Project, Free Software Foundation

  3. Which command changes the shell's current directory to `/var/log`?

    • cd /var/logCorrect
    • pwd /var/log
    • grep /var/log
    • chmod /var/log

    Why: `cd /var/log` asks the shell to change its working directory. `cd` is commonly a shell builtin, so its exact options are documented by the shell in use.

  4. What is the usual difference between `cp report.txt backup.txt` and `mv report.txt backup.txt`?

    • `cp` copies while `mv` moves or renamesCorrect
    • They are always identical
    • `cp` deletes and `mv` prints
    • `mv` only changes permissions

    Why: `cp` creates a copy at the destination while leaving the source, whereas `mv` relocates or renames the source. Existing destinations and options can affect behavior, so inspect important paths first.

  5. Why should `rm -r` be used carefully?

    • It can recursively remove directories and their contentsCorrect
    • It only prints a preview
    • It changes the working directory
    • It restores deleted files automatically

    Why: Recursive removal can delete an entire directory tree, and ordinary command-line removal may not provide a recycle bin. Verify the path and consider safer or interactive options before destructive use.

  6. What does `grep "ERROR" app.log` normally print?

    • Lines in app.log matching the pattern ERRORCorrect
    • The file's owner
    • All directories
    • A process list

    Why: `grep` searches input for lines matching a pattern and prints matching lines by default. Quoting patterns is a good habit when they may contain spaces or shell-special characters.

  7. In `chmod u+x script.sh`, what does `u+x` mean?

    • Add execute permission for the file ownerCorrect
    • Remove read permission from everyone
    • Change the owner name
    • Upload the file

    Why: In symbolic permission notation, `u` means the owning user, `+` means add, and `x` means execute or directory search permission. It does not grant the same permission to group or others.

  8. What does `ps` report?

    • A snapshot of processesCorrect
    • Disk file contents
    • Network passwords
    • Directory permissions only

    Why: `ps` reports a snapshot of selected processes. Its option syntax has several traditions, so `ps --help` and the local manual explain which selection and output formats apply.

  9. What is the safest first step when an unfamiliar command includes destructive-looking options?

    • Run it as administrator immediately
    • Read `man command` or `command --help` and test on noncritical dataCorrect
    • Paste it repeatedly
    • Remove the spaces

    Why: Manual pages and built-in help describe operands, options, exit status, and warnings. Testing on disposable data is safer than relying on an unexplained command copied from another environment.

  10. What does the pipe in `ps | grep worker` do?

    • Sends the standard output of `ps` to the standard input of `grep`Correct
    • Runs both commands with administrator rights
    • Deletes matching processes
    • Saves output to a file automatically

    Why: A shell pipeline connects one command's standard output to the next command's standard input. Here `grep` filters the textual process output; it does not terminate processes.