Linux Command Line & Shell Scripting Flashcards
7 cards from real 010-160 practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.
Read the first 7 Linux Command Line & Shell Scripting flashcards as text
Which shell built-in command displays the value of a variable named MYVAR?
Answer: echo $MYVAR
The echo command followed by the variable name prefixed with $ displays its value.
What does the pipe operator | do in a shell command?
Answer: Sends the output of one command as input to another
The pipe | connects the stdout of the left command to the stdin of the right command.
Which command lists only the directories inside /home?
Answer: ls -d /home/*/
ls -d /home/*/ matches only directory entries by appending a trailing slash glob.
In a bash script, what does the special variable $? represent?
Answer: The exit status of the last command
$? holds the exit code returned by the most recently executed foreground command.
Which command would you use to search for the string 'error' in all .log files under /var/log?
Answer: grep -r 'error' /var/log/*.log
grep with a pattern and a file glob searches for matching text within the specified files.
What is the result of running: echo {a,b,c}.txt?
Answer: Prints: a.txt b.txt c.txt
Brace expansion generates the strings a.txt, b.txt, and c.txt, which echo then prints.
Which redirection operator appends standard output to an existing file without overwriting it?
Answer: >>
The >> operator opens the file in append mode, adding new output after existing content.
Written and edited by Nathan Beja, founder of Practice Test Geeks, with AI assistance. Exam facts are checked against the official sources linked below. Editorial policy
Sources & references
Exam facts on this page (fees, format, dates, passing scores) are checked against these official sources; the date is our last check. Editorial policy
- lpi.org — Test delivery, eligibility, exam format, score validity, passing score, score release, fees · verified Dec 2026
- pearsonvue.com — Time limit · verified Nov 2026