Sunday, 21 April 2013

Argument list too long error for rm


Using wildcards such as * gives  arg list  too long error when there are lot of matches. Here we need to use pipe judiciously in such cases to overcome the limit.


You can use the below command in such situation to remove the files.

change to the prefered directory using cd  command and then run,

ls | xargs -n100 rm -f




Also, you can use find command in some situation  to change the directory/file permission like,


find . -type d -exec chmod 775 {} \; #Directory


find . -type f -exec chmod 664 {} \; #Files
 

No comments:

Post a Comment