Re: "ls -al * " not work

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



chloe K wrote:
Hi

My ls command not works  properly
Are there many files problem?

[host]# ls -al |wc -l
55264

[host]# ls -al *.db |more
-bash: /bin/ls: Argument list too long

[host]# ls -al *
-bash: /bin/ls: Argument list too long
[host]# ls -al *.*
-bash: /bin/ls: Argument list too long

Note that this comes from bash, not ls, and it results from expansion of the list to more characters than will fit in the buffer used to pass data to the (ls) command.

The kernel max has been expanded recently, but the bash shell probably has some kind of limit. If you have a lot of name, really long names, you can hit this. There are many ways to get around the problem, the best is not to have everything in one directory ;-)

you can do workarounds with find, xargs, little shell loops, etc:
  ls -a | while read name; do ls -l "$name"; done
if you have to use this type of directory structure you may have to learn other workarounds.

--
Bill Davidsen <davidsen@xxxxxxx>
  "We have more to fear from the bungling of the incompetent than from
the machinations of the wicked."  - from Slashdot

--
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux