Thursday, January 18, 2007

Argument list too long

When I execute the command:
# ls /media/dvd/Fedora/RPMS/*.rpm
bash: /bin/ls: Argument list too long

Q: What's the problem?
A: "The UNIX operating system traditionally has a fixed limit for the amount of memory that can be used for a program environment and argument list combined."
# getconf ARG_MAX
131072
# cd /media/dvd/Fedora/
# ls RPMS/*.rpm|wc
2931 2931 116609

If I include "/media/dvd/Fedora" in the list, it would exceed 131072. Reducing PATH name or using Shell script can run those commands correctly.

No comments: