Courseiva

010-160 · topic practice

The Power OF The Command Line practice questions

This domain covers working at the Linux shell: running commands, chaining them with pipes and operators, and filtering output. LPI tests it through practical scenarios using ls, grep, find, redirection, and exit-status logic, so you must read a described goal and pick the command or operator that actually produces it.

Courseiva uses original exam-style practice questions designed for learning and revision. The goal is to understand the concepts, recognise exam patterns, and improve through explanations — not memorise copied exam dumps.

Editorial oversight:Johnson Ajibi· MSc IT Security, IEEE Senior Member
20 questionsDomain: The Power OF The Command Line

What the exam tests

What to know about The Power OF The Command Line

You must be able to build a working command line: pipe output through grep, use find with time and size filters, redirect results to a file, and choose && versus ; based on exit status. Getting the operator and redirection right is the single most important thing.

Using pipes to send output between commands such as ls and grep

Filtering and searching file contents with grep, including line-number output

Locating files by size, modification time, and path using find

Chaining commands with operators like &&, ;, and redirection to files

Watch out for

Common The Power OF The Command Line exam traps

  • ▸Confusing ; with && — the semicolon runs the next command regardless, while && runs it only when the first succeeds.
  • ▸Forgetting that grep '^d' matches lines starting with d, not directories specifically, so output depends on ls formatting.
  • ▸Mixing up find's -mtime, -size, and redirection syntax, or writing the list to the screen instead of the target file.

Practice set

The Power OF The Command Line questions

20 questions · select your answer, then reveal the explanation

You have a large log file and want to view only the last 20 lines. Which command is best?

You want to combine the output of 'cat file1' and 'cat file2' and count the total number of lines in the result. Which pipe sequence is correct?

You are using 'tar' and want to extract an archive named 'backup.tar.gz' into a specific directory named '/tmp/restore'. Which command is correct?

You have a compressed file 'data.tar.bz2'. Which flag is needed to extract it?

How do you redirect both standard output and standard error to a file named 'output.log'?

What is the purpose of the 'tee' command?

Which command displays the first 5 lines of a file?

Which command shows the manual page for 'ls'?

Which THREE of the following are valid flags for the 'tar' command?

Which TWO of the following are correct ways to set an environment variable?

While troubleshooting a server, you run `grep -r 'timeout' /etc/nginx/` and receive output that includes the filename and line number for every match. You now need to count only the total number of matching lines across all files, without displaying the matches themselves. Which command pipeline or option achieves this?

Question 12mediummultiple choice
Read the full network assurance explanation →

A user wants to count how many lines in the file /var/log/syslog contain the word 'error'. Which command accomplishes this?

You are working in a directory containing a file named `report.txt`. You want to make a copy of this file named `report_backup.txt` in the same directory. Which command accomplishes this?

A developer runs a program that writes progress messages to standard error and results to standard output. They want to save only the results to results.txt while still seeing progress messages on the terminal. Which redirection accomplishes this?

You are examining a shell script and see the line `find /var/log -type f -name '*.log' -exec rm {} \;`. You want to modify this command so that it deletes matching files in a single rm invocation for better performance, while still handling filenames with spaces correctly. Which change should you make?

You are reviewing file permissions and want to identify which of the following statements about the `chmod` command are true. (Choose two.)

A user is editing a configuration file with vim and wants to save the changes and exit the editor immediately. Which command should they type in vim's command mode?

A system administrator needs to extract a specific file named 'config.yml' from a tarball 'app.tar.gz' without extracting the entire archive. Which command should be used?

You are troubleshooting a user's account and want to view the contents of the environment variable HOME without launching a subshell or external program. Which command displays its value?

A user wants to find all files under /home that are larger than 10 MB and were modified more than 30 days ago, then delete them. Which command sequence is correct?

Free account

Track your progress over time

Create a free account to save your results and see which topics improve across sessions.

Focused The Power OF The Command Line sessions

Start a The Power OF The Command Line only practice session

Every question in these sessions is drawn from the The Power OF The Command Line domain — nothing else.

Related practice questions

Related 010-160 topic practice pages

Move into related areas when this topic feels solid.

Frequently asked questions

What does the 010-160 exam test about The Power OF The Command Line?
You must be able to build a working command line: pipe output through grep, use find with time and size filters, redirect results to a file, and choose && versus ; based on exit status. Getting the operator and redirection right is the single most important thing.
How should I use these practice questions?
Select your answer before revealing the explanation. Then read why each option is right or wrong — this active recall approach builds retention far faster than re-reading notes.
Can I practise just The Power OF The Command Line questions in a focused session?
Yes — the session launcher on this page draws every question from the The Power OF The Command Line domain. Use a 10-question session first to gauge your baseline, then move to 20 or 30 once the weak spots are clear.
Where can I practise other 010-160 topics?
Use the topic links above to move to related areas, or go back to the 010-160 question bank to see all topics.
Are these real exam questions or dumps?
These are original practice questions written to test the same concepts the 010-160 exam covers. They are not copied from any real exam or dump site.