Your message dated Wed, 12 Mar 2014 11:51:03 -0600
with message-id <[email protected]>
and subject line Re: Bug#741443: coreutils: ls -C not work, column output
problem
has caused the Debian Bug report #741443,
regarding coreutils: ls -C not work, column output problem
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)
--
741443: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=741443
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: coreutils
Version: 8.21-1
Severity: normal
Hello!
Sorry my bad English
globus@aspera:/tmp/sox$ ls
001.mp3 002.mp3 003.mp3 004.mp3 005.mp3
globus@aspera:/tmp/sox$ ls -C
001.mp3 002.mp3 003.mp3 004.mp3 005.mp3
globus@aspera:/tmp/sox$ man ls:
-C list entries by columns
If I understand correctly the meaning of this key
-- System Information:
Debian Release: jessie/sid
APT prefers testing-proposed-updates
APT policy: (500, 'testing-proposed-updates'), (500, 'testing'), (500,
'oldstable')
Architecture: i386 (i686)
Kernel: Linux 3.12-1-686-pae (SMP w/2 CPU cores)
Locale: LANG=ru_RU.UTF-8, LC_CTYPE=ru_RU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages coreutils depends on:
ii libacl1 2.2.52-1
ii libattr1 1:2.4.47-1
ii libc6 2.18-4
ii libselinux1 2.2.2-1
coreutils recommends no packages.
coreutils suggests no packages.
-- no debconf information
--- End Message ---
--- Begin Message ---
Yoric Ko wrote:
> globus@aspera:/tmp/sox$ ls
> 001.mp3 002.mp3 003.mp3 004.mp3 005.mp3
Yes.
> globus@aspera:/tmp/sox$ ls -C
> 001.mp3 002.mp3 003.mp3 004.mp3 005.mp3
Also yes.
> globus@aspera:/tmp/sox$ man ls:
>
> -C list entries by columns
>
> If I understand correctly the meaning of this key
I think you are wanting the -1 option.
The ls documentation says:
10.1.5 General output formatting
--------------------------------
...
-C
--format=vertical
List files in columns, sorted vertically. This is the default for
`ls' if standard output is a terminal. It is always the default
for the `dir' program. GNU `ls' uses variable width columns to
display as many files as possible in the fewest lines.
Because your directory only contained 5 files and their names were
short enough to display on one line then listing did not flow into the
next line and therefore the columns were only one high. The columns
existed. There are five columns in your example. But the columns
were only one row high.
mkdir /tmp/ls-test-dir
cd /tmp/ls-test-dir
for f in $(seq 1 50); do touch test$f;done
ls -C
On a standard 80 column terminal either 'ls' or 'ls -C' will display this:
test1 test14 test19 test23 test28 test32 test37 test41 test46 test50
test10 test15 test2 test24 test29 test33 test38 test42 test47 test6
test11 test16 test20 test25 test3 test34 test39 test43 test48 test7
test12 test17 test21 test26 test30 test35 test4 test44 test49 test8
test13 test18 test22 test27 test31 test36 test40 test45 test5 test9
Files are sorted vertically. The display is top to bottom, left to
right. The lowest name sorted file is in the top left. The highest
name sorted file is in the bottom right.
Because '-C' is the default when invoked without any options this is
the normal behavior most people see with ls. However if the -1 option
is given:
-1
--format=single-column
List one file per line. This is the default for `ls' when standard
output is not a terminal.
Then the output will be a single column only. The -C and -1 options
are the opposites of each other as can be noted by the --format long
option which -1 is single-column and -C is vertical. There is also
the -x,--format=across,--format=horizontal option which sorts them
left to right, top to bottom for the other display sorting order.
ls -x
test1 test10 test11 test12 test13 test14 test15 test16 test17 test18
test19 test2 test20 test21 test22 test23 test24 test25 test26 test27
test28 test29 test3 test30 test31 test32 test33 test34 test35 test36
test37 test38 test39 test4 test40 test41 test42 test43 test44 test45
test46 test47 test48 test49 test5 test50 test6 test7 test8 test9
Also ls behavior depends upon the output being a tty. If the output
is a tty then the behavior default to -C. If the output is not a tty
then the behavior defaults to -1.
ls | less
ls | grep
ls | ...whatever...
All of those will use the -1, --format=single-column by default. This
makes ls behave mostly as desired both when listing files on the
command line and when using it in a pipeline in a script. It does
different things at different times but it defaults to what people
expect it should do in each case.
I hope this answers your question. As you can see this is not a bug
in ls but simply one of understanding the behavior. I think you are
wanting the 'ls -1' option. Therefore I have marked this bug as
closed. Please feel free to follow up with further discussion.
Bob
signature.asc
Description: Digital signature
--- End Message ---