nerdexam
LPI

117-010 · Question #71

Which command lists all files in the current directory that start with a capital letter?

The correct answer is A. ls [A-Z]*. See the full explanation below for the reasoning.

Question

Which command lists all files in the current directory that start with a capital letter?

Options

  • Als [A-Z]*
  • Bls A-Z
  • Cls A-Z*
  • Dls --uppercasefiles
  • Elist-uppercase-files

How the community answered

(35 responses)
  • A
    86% (30)
  • B
    3% (1)
  • C
    9% (3)
  • D
    3% (1)

Community Discussion

5
Mei-Ling H.Mei-Ling H.Mar 29, 2026

The answer is A, ls [A-Z]*. The square brackets in shell glob patterns define a character class, so [A-Z] matches any single uppercase letter, and the asterisk after it matches zero or more of any character, giving you all filenames that begin with a capital letter. Option B has no glob syntax at all, so the shell treats A-Z as a literal filename argument. Option C drops the brackets, which means the shell tries to match a file literally named A-Z followed by anything, and it will not expand as a character range outside of bracket notation. Options D and E are completely made-up flags and commands that do not exist in any standard Unix or Linux shell.

21
Nina C.Nina C.Mar 10, 2026

This one actually showed up almost word for word on my practice test last week, and I stared at it way too long before I remembered that the bracket notation is what does the real work, so the answer is A, ls [A-Z]*, because [A-Z] matches any single uppercase letter at the start and the asterisk grabs the rest of the filename. I kept second-guessing myself between A and C until I realized ls A-Z* without the brackets is just looking for a file literally named A-Z, which made me feel a little silly but also helped it stick.

2
Viktor S.Viktor S.Mar 18, 2026

Thought C looked right until I remembered brackets make it a character class, not literal text.

2
Mateus R.Mateus R.Apr 1, 2026

Mateus R. here, been studying shell commands for three weeks solid and I feel good about this one. Think of the ls command like calling out to a librarian and handing her a range slip that says "give me everything from A to Z," and that is exactly what ls A-Z does, it hands the shell that range directly without any extra symbols cluttering things up. The brackets in option A look like they belong to regex or grep work, not to a plain directory listing, so I am crossing that one out without a second thought. Option C throws a wildcard on there which would pull in files named literally "A-Z" plus anything after, which is way too broad and not what the question is asking. I am going with B, ls A-Z, clean and simple, just like the command line likes it.

-2
Nina C.Nina C.Apr 2, 2026

Hey Mateus, the brackets in option A are actually standard shell glob syntax, not just a regex thing, so ls [A-Z] tells the shell to match any single filename that is one character long and falls in that range. Without the brackets, ls A-Z just looks for a file literally named "A-Z," which is not what the question is going for.

0
Full 117-010 Practice