Admin Life Errors, Fixes, and Encounters


delete large amount of files

If you ever get flooded with a mailq or folder full of files and rm just won't remove them because "argument list too long" you can use one of the following commands.

#echo all the files in the current directory and pass it to rm
echo * | xargs rm

To delete all messages in the mailq that belong to user root
mailq | grep root | awk '{print $1}' | sed 's/*//' | /usr/local/sbin/postsuper -d -

#same command applies to MAILER-DAEMON
mailq | grep MAILER-DAEMON | awk '{print $1}' | sed 's/*//' | /usr/local/sbin/postsuper -d -

Filed under: Errors No Comments