what is the ls option to list entries by lines instead of by columns?

3 days ago 3
Nature

The ls option to list entries by lines instead of by columns is -1 (the digit one). Using ls -1 will output one entry per line, listing files vertically rather than in multiple columns. This option is specifically designed to list filenames only, one per line, without additional details unless combined with other options

. For example:

ls -1

will produce output like:

file1.txt
file2.txt
directory1
file3.txt

This differs from the default behavior of ls which tries to fit entries into multiple columns when outputting to a terminal. The -1 option forces a single column listing regardless of output target

. In summary, the key option is:

  • -1 : list one entry per line (single-column format)