doc: ls: mention the default output formats in the man page

Also clarify that -C and -1 only output the file name.

* doc/coreutils.texi (General output formatting): Tweak the -C
description to emphasize that only names are output.
* src/ls.c (usage): Clarify that only names are printed with -1 and -C,
and mention which is the default depending on tty output and
which of ls,dir,vdir is in use.

Link: https://github.com/coreutils/coreutils/issues/405
This commit is contained in:
Pádraig Brady committed 2026-11-04 12:03:43 +00:00
1 parent 45cf8a870f
commit 38bdf759e3
2 files changed
+28 -3

No files matched your search

+1 -1
View File
@@ -8124,7 +8124,7 @@ except that it has no effect if long format is also in effect.
@itemx --format=vertical
@opindex --format
@opindex vertical @r{sorted files in columns}
List files in columns, sorted vertically, with no other information.
List file names in columns, sorted vertically, with no other information.
This is the default for @command{ls} if standard output is a terminal.
It is always the default for the @command{dir} program.
GNU @command{ls} uses variable width columns to display as many files as
+27 -2
View File
@@ -5461,9 +5461,21 @@ Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.\n\
with -l: show ctime and sort by name;\n\
otherwise: sort by ctime, newest first\n\
"));
if (ls_mode == LS_LS)
oputs (_("\
-C\n\
list entries by columns\n\
list file names by columns, sorted vertically;\n\
the default format if standard output is a terminal\n\
"));
else if (ls_mode == LS_MULTI_COL)
oputs (_("\
-C\n\
list file names by columns, sorted vertically; the default format\n\
"));
else
oputs (_("\
-C\n\
list file names by columns, sorted vertically\n\
"));
oputs (_("\
--color[=WHEN]\n\
@@ -5553,6 +5565,12 @@ Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.\n\
default to 1024-byte blocks for file system usage;\n\
used only with -s and per directory totals\n\
"));
if (ls_mode == LS_LONG_FORMAT)
oputs (_("\
-l\n\
use a long listing format; the default\n\
"));
else
oputs (_("\
-l\n\
use a long listing format\n\
@@ -5681,9 +5699,16 @@ Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.\n\
--zero\n\
end each output line with NUL, not newline\n\
"));
if (ls_mode == LS_LS)
oputs (_("\
-1\n\
list one file per line\n\
list one file name per line;\n\
the default format if standard output is not a terminal\n\
"));
else
oputs (_("\
-1\n\
list one file name per line\n\
"));
oputs (HELP_OPTION_DESCRIPTION);
oputs (VERSION_OPTION_DESCRIPTION);