Getting "Argument list too long" when using ls
I was trying to count the number of files in a particular directory in Linux using the ls command and received the following error:
oracle@soadev:/home/oracle> ls /u01/archive/*.* | wc -l
-bash: /bin/ls: Argument list too longTurns out the resolution to this is to increase increase the stack space to a higher value:
oracle@soadev:/home/oracle> ulimit -s
10240
oracle@soadev:/home/oracle> ulimit -s 65536
oracle@soadev:/home/oracle> ls /u01/archive/*.* | wc -l
97101References: