I found out it's possible to show the output of the ls
command vertically using the -1
switch:
$ ls -1
But couldn't find it in the manual of ls
. Is it a secret option?
The manual is out of date with the program. Try ls --help | grep -- ' -1'
:
-1 list one file per line
It is one of the last options described if you just do ls --help
.
/bin/ls
also gives output in columns, at least it does on my system. What is your ls
aliased to?
– terdon
Feb 01 '14 at 19:17
As @Timo indicates -1
is in the help, and @terdon points out the -1
is documented in the manual for some version. coreutils
8.13 has that error in the man page, version 8.22 doesn't anymore.
In the hacking guidelines for coreutils. It is specified that
The man pages are generated from --help output, so you shouldn't need to change anything under man/.
So there must be something broken in the conversion causing the similar -m
to show up but not the -1
. While building ls
with the patch I proposed in answer to @timo's question, the manual page for ls
gets regenerated correctly and the relevant part reads:
-Z, --context print any security context of each file
-1 list one file per line
-0 list files separated with NUL
--help display this help and exit
--version output version information and exit
And without that patch, the -1 shows up in the manual as well. The git log
shows no specific action to correct this. As recent as Sep 2013 help2man
, which is used to generate the man pages, was updated. The help2man
ChangeLog
doesn't show a specific action either.
I suppose this will depend on your ls
implementation but on my LMDE (basically Debian testing) I have:
$ man ls | grep -- '-1'
across -x, commas -m, horizontal -x, long -l, single-column -1,
-1 list one file per line
As well as (yes, it's the same output)
$ ls --help | grep -- '-1'
across -x, commas -m, horizontal -x, long -l, single-column -1,
-1 list one file per line
man ls
does tell:-1 list one file per line
. Info pages usually contain more information, tryinfo ls
. – devnull Feb 01 '14 at 09:11