nerdexam
LPI

010-160 · Question #104

What parameter of ls prints a recursive listing of a directory's content? (Specify ONLY the option name without any values or parameters.)

-R

The Power of the Command Line

Question

What parameter of ls prints a recursive listing of a directory's content? (Specify ONLY the option name without any values or parameters.)

Explanation

-R

Topics

#ls command#recursive listing#command options#directory listing

Community Discussion

9
Bao N.Bao N.Oct 20, 2025

The answer is -R, and this one comes up constantly on the 010-160 so burn it into memory now. The -R flag tells ls to descend into every subdirectory it encounters and print its contents, which is why it stands for recursive. A lot of people confuse it with -r, which just reverses the sort order, and that lowercase vs uppercase mix-up is exactly the kind of trap the exam leans on. If you are drilling this, type ls -R /etc on a live Linux box once and watch it dump the whole tree, because seeing it run is worth more than reading the man page twice.

24
Mateus R.Mateus R.Apr 30, 2026

Think of how a building inspector walks a property, the first floor, then every room on the second floor, then every room on the third, going deeper and deeper until there is nothing left unchecked. That is exactly what the -R option does for ls, it descends into every subdirectory it finds and lists the contents there too, rather than stopping at the top level. The correct answer here is -R, uppercase R, and that distinction matters because lowercase -r means reverse sort order, a completely different behavior that will cost you points if you mix them up. When the exam says "recursive listing," lock in on -R and you will not go wrong.

16
Yusuf A.Yusuf A.Oct 23, 2025

I first leaned toward -l thinking that was the one for detailed output, but then I remembered my senior showing me how -R is the one that actually digs into subdirectories and lists everything inside them recursively. Once I connected the R to "Recursive" it clicked pretty fast.

5
Wesley A.Wesley A.Oct 24, 2025

Good memory trick on the R, but worth burning in that -l is still pulling its weight in your day to day since that long-format output is where you actually see permissions, ownership, and timestamps all at once.

0
Lena V.Lena V.May 3, 2026

My first instinct was -r because I kept conflating "recursive" with "reverse," and both start with r so my brain was just pattern-matching sloppily under time pressure. What snapped me out of it was remembering that lowercase -r on ls reverses the sort order, which is a totally different thing. The recursive flag is uppercase -R, and the capitalization distinction actually matters on Linux because the shell is case-sensitive. Once I tied uppercase -R to "big task, goes deeper" and lowercase -r to "just flip the list," I stopped mixing them up on practice questions.

3
Ingrid P.Ingrid P.May 10, 2026

I kept wanting to write -r because that is the flag I have on more cards from other commands, but the recall cue that finally stuck it for me is that -R (uppercase) means Recurse into subdirectories, and I tied it to the capital R standing for a bigger operation going deeper into the tree.

1
Wesley A.Wesley A.Oct 12, 2025

The question is a bit sloppy because it says "Specify ONLY the option name" without telling you whether they want the short form or the long form, but the answer they are looking for is -R, and if you put --recursive you might get marked wrong depending on how strict the grader is. Burned me the first time overthinking it, just go with -R.

0
Yusuf A.Yusuf A.Oct 13, 2025

Yeah Wesley that tracks, though worth noting that on some older UNIX-style graders I have seen --recursive accepted too, so if you have time just write both and let the grader pick.

0
Toby R.Toby R.May 18, 2026

Saw this exact wording on mine and I put -r without hesitation. The exam kept using "recursive" and "reverse" almost interchangeably in the surrounding objectives, and when I tested it in the practice environment the -r flag was the one that kept coming up in the context of drilling down into subdirectories. I get why people jump to -R but that capital letter tripped me up early in my studies and after going back through the material I landed on lowercase for the actual test scenario they described.

-2
Full 010-160 Practice