`gzip /var/log/app/*.log` fails with `bash: /usr/bin/gzip: Argument list too long`
IntermediateTroubleshootingTroubleshooting: quoting, expansion and tool-input bugs
Answer
Likely causes → The glob expanded to so many filenames that the arguments exceed the kernel's ARG_MAX limit for execve().
Diagnose →
getconf ARG_MAX
find /var/log/app -maxdepth 1 -name '*.log' | wc -l
Fix → Let find batch the arguments:
find /var/log/app -maxdepth 1 -name '*.log' -exec gzip -- {} +
Prevent → Use find -exec {} + or xargs -0 for bulk operations; fix the retention that let 300,000 files accumulate.
More on Troubleshooting: quoting, expansion and tool-input bugs
`bash: [: too many arguments`Beginner`bash: [: =: unary operator expected`BeginnerA disk check fails with `[: 93%: integer expression expected`Beginner`rm $file` fails with `rm: cannot remove 'monthly': No such file or directory` and `rm: cannot remove 'report.csv'`.BeginnerA cleanup script logs `cp: cannot stat '/var/log/app/*.log': No such file or directory` on quiet days.Beginner`echo "start" > $logfile` fails with `bash: $logfile: ambiguous redirect`Intermediate