rm returns an error as Argument list too long

Asked by Azker Mohamed

Hi there,

I would like to to know how to use the "rm" command on terminal for a dir which holds lot of files. Reason is that when I use "rm -rf *" to delete all files, it returns with an error as "bash: /bin/rm: Argument list too long".. I even tried the "find" command with "xorg" which also returned me with no luck.

Please advise me on how I can delete these files efficiently.

Thanks in advance.

Rgds,
Asker M

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
N1ck 7h0m4d4k15
Solved:
Last query:
Last reply:
Revision history for this message
Best N1ck 7h0m4d4k15 (nicktux) said :
#1

Even rm command has its limits.

Use a pipe.

Example on how to remove all the .tmp files from a folder and we assume that they are lot. So many that rm failing to remove them.

    find -name "*.tmp" | xargs /bin/rm

Regards
 NikTh

Revision history for this message
Azker Mohamed (asker-styile) said :
#2

Thanks NikTh, that solved my question.