 |
|
 |
|
|
 |
ls *.txt gives "bash: /bin/ls: Argument list too long" !? |
 |
 |
|
|
01-23-04 10:10 PM
In issuing the following command to BASH on RH 8.0 I receive the error
"bash: /bin/ls: Argument list too long" What gives?
Command issued was:
ls *.txt
Surely there's a way around this, but the man and info pages don't
really have any information in this regard. Any help is always
apprecaited, thanks,
Rob
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
 |
Re: ls *.txt gives "bash: /bin/ls: Argument list too long" !? |
 |
 |
|
|
01-23-04 10:10 PM
On 14 Dec 2003 15:52:15 -0800, Rob Baxter wrote:quote:
> In issuing the following command to BASH on RH 8.0 I receive the error
> "bash: /bin/ls: Argument list too long" What gives?
>
> Command issued was:
>
> ls *.txt
>
> Surely there's a way around this, but the man and info pages don't
> really have any information in this regard. Any help is always
> apprecaited, thanks,
Today's Tip of the Day, very large
Frequently Asked Questions (faq) Search engine:
http://groups.google.com/advanced_group_search
Argument list too long in the first box
*linux* in the Newsgroup, pick English
Results 1 - 10 of about 5,080. Search took 2.02 seconds
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
 |
Re: ls *.txt gives "bash: /bin/ls: Argument list too long" !? |
 |
 |
|
|
01-23-04 10:10 PM
just do a 'find . -name "*.txt" -exec WHATEVER_COMMAND {} \;'
That will show you all files, or just replace the exec with ls to just see
the file names.
"Rob Baxter" <rbaxter@cyence.com> wrote in message
news:baea5fa.0312141552.f389bb5@posting.google.com...quote:
> In issuing the following command to BASH on RH 8.0 I receive the error
> "bash: /bin/ls: Argument list too long" What gives?
>
> Command issued was:
>
> ls *.txt
>
> Surely there's a way around this, but the man and info pages don't
> really have any information in this regard. Any help is always
> apprecaited, thanks,
>
> Rob
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
 |
Re: ls *.txt gives "bash: /bin/ls: Argument list too long" !? |
 |
 |
|
|
01-23-04 10:10 PM
On 14 Dec 2003 15:52:15 -0800, Rob Baxter
<rbaxter@cyence.com> wrote:quote:
> In issuing the following command to BASH on RH 8.0 I receive the error
> "bash: /bin/ls: Argument list too long" What gives?
>
> Command issued was:
>
> ls *.txt
>
> Surely there's a way around this, but the man and info pages don't
> really have any information in this regard. Any help is always
> apprecaited, thanks,
>
ls | grep '\.txt$'
--
Thanks to Nigeria, any email with the word "urgent" in the subject
or address will be deleted.
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
 |
Re: ls *.txt gives "bash: /bin/ls: Argument list too long" !? |
 |
 |
|
|
01-23-04 10:10 PM
On Sun, 14 Dec 2003 15:52:15 -0800, Rob Baxter wrote:
quote:
> In issuing the following command to BASH on RH 8.0 I receive the error
> "bash: /bin/ls: Argument list too long" What gives?
>
> Command issued was:
>
> ls *.txt
>
> Surely there's a way around this, but the man and info pages don't
> really have any information in this regard. Any help is always
> apprecaited, thanks,
>
> Rob
Well thats interesting. Check the ls command first to see if it has been
aliased to something odd. Type "alias" by itself and see if there is a
listing for ls. Or just nuke any alias by typing "unalias ls". Then try
the command.
If no aliases exist you have found a bug. Type this:
"sh --version"
To get your version of bash. Mine is
GNU bash, version 2.05b.0(1)-release (i686-pc-linux-gnu)
Perhaps RedHat has an update for you?
I hope something in this helps you.
MS
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
 |
Re: ls *.txt gives "bash: /bin/ls: Argument list too long" !? |
 |
 |
|
|
01-23-04 10:10 PM
Michael Studer wrote:
quote:
> On Sun, 14 Dec 2003 15:52:15 -0800, Rob Baxter wrote:
>
[...][QUOTE]
> Well thats interesting. Check the ls command first to see if it has been
> aliased to something odd. Type "alias" by itself and see if there is a
> listing for ls. Or just nuke any alias by typing "unalias ls". Then try
> the command.
>
> If no aliases exist you have found a bug.
It's not a bug. It's expected behavior, and precisely what xargs(1) is
meant to solve:
find . -name \*.txt | xargs ls
Cheers,
M.
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
 |
Re: ls *.txt gives "bash: /bin/ls: Argument list too long" !? |
 |
 |
|
|
01-23-04 10:10 PM
On Tue, 16 Dec 2003 06:11:11 +0000, Matias Atria wrote:quote:
>
> It's not a bug. It's expected behavior, and precisely what xargs(1) is
> meant to solve:
>
> find . -name \*.txt | xargs ls
>
> Cheers,
> M.
Oh really? Hmm then I must have a bug on my system.
quote:
> ls *.txt
junk.txt junk1.txt junk2.txt
MS
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
 |
Re: ls *.txt gives "bash: /bin/ls: Argument list too long" !? |
 |
 |
|
|
01-23-04 10:10 PM
Michael Studer wrote:
quote:
> On Tue, 16 Dec 2003 06:11:11 +0000, Matias Atria wrote:
>
>
>
> Oh really? Hmm then I must have a bug on my system.
>
>
>
> junk.txt junk1.txt junk2.txt
>
> MS
The original poster has a lot of .txt files and *.txt when expanded is
too long a string to fit in the command line buffer which has a finite
length. The find / xargs combination is a known way of dealing with
this situation.
So in that respect, it IS expected behaviour.
Except I never expect it when it happens to me :-)
Cheers
JK
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
 |
Re: ls *.txt gives "bash: /bin/ls: Argument list too long" !? |
 |
 |
|
|
01-23-04 10:10 PM
Rob Baxter wrote:
quote:
> In issuing the following command to BASH on RH 8.0 I receive the error
> "bash: /bin/ls: Argument list too long" What gives?
Your shell is performing pathname expandsion on "*.txt" and the result
is too big for the command line buffer. This is a common problem
quote:
> Command issued was:
>
> ls *.txt
It doesn't matter, any command fed *.txt unquoted(') will exhibit the
same problem.
quote:
> Surely there's a way around this,
Many ways, for example:
ls | grep '\.txt$'
find -name "*.txt" | xargs ls
su root then ls *.txt
quote:
> but the man and info pages don't
> really have any information in this regard.
You are right, the correct place for this is ...
man bash /pathname expansion
man xargs
but the man pages on RH8.0 are poor in this regard.
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
 |
Re: ls *.txt gives "bash: /bin/ls: Argument list too long" !? |
 |
 |
|
|
01-23-04 10:10 PM
Michael Studer wrote:quote:
> Matias Atria wrote:
>
Because the buffers built into shells are of finite size.
[QUOTE]
>
>
> Oh really? Hmm then I must have a bug on my system.
>
> ls *.txt
> junk.txt junk1.txt junk2.txt
So did you really seriously expect 3 whole filenames to blow
the internal buffers of the shell? Right, I thought not.
[ Post a follow-up to this message ]
|
|
|
 |
|
|
|
|
Sponsored Links |
 |
 |
|
|
 |
All times are GMT. The time now is 01:25 PM. |
 |
|
|
 |
|
 |
|
|
 |
|
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
|
|
|
|
Medical and Health forum | Computer Games Reviews | Graphics design forum
|
 |
|
 |
|