This error is not very common but this is something that you will see for sure in your daily routine if you are a Linux user. Lets say you are working with Apache webserver and there comes a situation where you have to delete log files for Apache.
[root @ guest logs]# pwdTry issuing the "rm" command to delete those long list of files
/u01/app/oracle/product/j2ee/Apache/Apache/logs
[root @ guest logs]# ls -l | grep log | wc -l
5195
[root @ guest logs] # rm *log*If that returns an error message regarding "Argument list too long" then there are
/bin/rm: Argument list too long.
alternatives to remove the files. It seems that the rm command can't deal with such
number of arguments. Fortunately there are some workarounds for this problem.
You can combine rm with find:
find . | xargs rm -f
Or if you want to delete all the files in the directory with a single stroke issue the following code:
ls | xargs rm -f
No comments:
Post a Comment