Home » Infrastructure » Unix » ls (Unix)
ls [message #288046] Fri, 14 December 2007 08:24 Go to next message
kshitij.raj
Messages: 7
Registered: July 2007
Junior Member
Hi,

Could you please tell me that what is the limitation of using ls *.* in terms of number of files or size.

Sometimes, i get error as "argument list too long".

[Updated on: Fri, 14 December 2007 08:40]

Report message to a moderator

Re: ls [message #288047 is a reply to message #288046] Fri, 14 December 2007 08:34 Go to previous messageGo to next message
ritvikd
Messages: 11
Registered: January 2007
Junior Member
ls *.* under specific directory will show all files under that directory irrespective of filename and extension. Note that it won't show you hidden files.
Re: ls [message #288050 is a reply to message #288046] Fri, 14 December 2007 08:45 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
If you want to list all files, just use "ls".

Regards
Michel
Re: ls [message #288083 is a reply to message #288047] Fri, 14 December 2007 13:23 Go to previous message
ThomasG
Messages: 3211
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
ritvikd wrote on Fri, 14 December 2007 15:34

ls *.* under specific directory will show all files under that directory irrespective of filename and extension. Note that it won't show you hidden files.


Actually, it will show all (non-hidden) files and directories with a DOT in the name.

Under Linux/Unix there are a lot of files which don't have a dot in the name, since the extension is not needed as much as it is in Windows. And directories don't have dots in them very often.

As for the "Argument List To Long" problem:

When you run "ls" only, it simply lists all files in the directory.

When you run "ls *" a list with all files in the directory is created, and passed to ls. That's why ls also lists the contents of directories one level down, when you run it that way.

There you run into the limit of command line parameters (which is 131072 under Linux, I think)

Instead of

ls *pattern*


You can use, for example,

find . -iname "*pattern*"  | xargs ls


If you run into "argument list too long" problems. Note the quotes around *patter*, which tell the shell to pass *pattern* to find as it is, not to try to create an argument list out of it.

Previous Topic: How to identify Asynchronous I/O?
Next Topic: query to get a value from database
Goto Forum:
  


Current Time: Thu Mar 28 06:34:10 CDT 2024