Argument list too long

This tip is very usefull if you need to clean an directory and receive this error :

[root@matrix:/tmp]# rm -f *
-bash: /bin/rm: Argument list too long

There are two ways to solve this problem. One is with the for command of bash ( or another shell do you use ) and the other is using the command line.

The first way is :

for i in *; do rm -f $i; done

Or the other way is use the find command of the Unix World.

find . -name '*' -print0 | xargs -0 rm

This is isn't a new tip, but this is very usefull :-)

comments powered by Disqus