Interview Prep/Linux/Disk space, inodes and filesystems

A cron job that runs `rm /var/spool/app/*` fails with `/bin/rm: Argument list too long`.

BeginnerTroubleshootingDisk space, inodes and filesystems
Answer

Likely causes → The glob expands to more arguments than ARG_MAX allows.

Diagnose →

getconf ARG_MAX
find /var/spool/app -maxdepth 1 -type f | wc -l

Fix → find /var/spool/app -maxdepth 1 -type f -delete, or find ... -print0 | xargs -0 rm.

Prevent → Use find in scripts for anything that can grow; clean the directory more often.

All Linux questions Roadmap: Linux

More on Disk space, inodes and filesystems