What does the "ls -1" command do?
Yes, the formatting of the output is the only difference between ls -1
and ls
without any options.
From the ls
manual on my system:
-1 (The numeric digit "one".) Force output to be one entry per line.
This is the default when output is not to a terminal.
This is also a POSIX option to the ls
utility.
The manual for ls
on your system is bound to say something similar (see man ls
).
Related:
- is piped ls the same as ls -1?
ls -1
lists one file per line. By default, when it’s outputting to a terminal, ls
lists files in columns, whose number varies depending on the length of the file names and the available space on screen.
To find this kind of information, man ls
works better than ls --help
. (This is true for most commands.)