Resolved – bash /usr/bin/find Arg list too long
Have you ever met error like the following?
root@doxer# find /PRD/*/connectors/A01/QP*/*/logFiles/* -prune -name "*.log" -mtime +7 -type f |wc -l
bash: /usr/bin/find: Arg list too long
The cause of issue is kernel limitation for argument count which can be passed to find (as well as ls, and other utils). ARG_MAX defines
the maximum length of arguments for a new process. You can get the number of it using command:
root@doxer# getconf ARG_MAX
To quickly fix this, you can move your actions into the directory(replace * with subdir_NAME):
cd /PRD/subdir_NAME/connectors/A01/QP*/*/logFiles/;find . -prune -name "*.log" -mtime +7 -type f |wc -l
- you can get all configuration values with getconf -a.
- For more solutions about the error "bash: /usr/bin/find: Arg list too long", you can refer to http://www.in-ulm.de/~mascheck/various/argmax/