-1

I was trying to learn more about Linux and came across the command ls ????? and it displayed a few files in the directory but I am not really sure what it is specifically displaying. I tried to use the man to explain it further but I couldn't find anything. Could someone please explain?

6

1 Answer 1

-4

ls is a command on its own - try man ls for an explanation. ls ? may give a help summary in some Linux versions. ls with multiple ? is pointless as far as I know unless all the files listed have just five characters?.

4
  • I found that the ls ????? will display files/directories with names of 5 characters. If I wanted to search for a file that I know started with R and was 5 characters but didn't remember the name I would us ls R???? and that would give me everything in that directory matching those requirements.
    – rikito104
    Commented Jun 1, 2020 at 17:49
  • 1
    This question has very little to do with ls and much more to do with the question-marks... in fact, using a varying number of question marks demonstrates the point.
    – Jeff Schaller
    Commented Jun 1, 2020 at 17:50
  • It looks like it is matching for patterns, normally ls R* would give you any filenames of any length and R???? will do what you say. Perhaps look at man grep for more details on pattern matching.
    – Ralph_CCL
    Commented Jun 1, 2020 at 17:56
  • 1
    ls /? would give a help summary... in DOS and Windows. (Except that the command there is called dir) I don't think I've ever seen /? or -? or such as giving a help text in any unix programs. ? by itself is a valid filename pattern (glob) for a one-letter filename, which you pretty much already know based on that last sentence. grep uses regular expressions, they're not the same as glob patterns. See here for the latter: mywiki.wooledge.org/BashGuide/Patterns
    – ilkkachu
    Commented Jun 1, 2020 at 18:08

Not the answer you're looking for? Browse other questions tagged .