The ls command lists the contents of a directory.
ls
is a command to list files and their metadata (time, size, owner, etc.). Some implementations can show files in color.
ls
does not expand wildcards: this is done by the shell.
It is very nearly always a mistake to use ls
in a script. If you're just expanding wildcards, the shell does it already. If you're looking for files based on criteria such as their size or time, use find (or zsh's glob qualifiers if you have zsh).
External references
- ls specification (The Open Group Base Specifications Issue 7, 2018 edition)
- ls invocation (GNU Coreutils)