delete file: Argument list too long in Linux
Argument list too long in Linux
use find
find . -name filename | xargs rm -f
too many files may also cause the argument list too long problem in find
. Could use ls
and grep
instead.
ls |grep YOUR_FILE_PATTERN |xargs rm -f
use xargs
ls | xargs -n 50 rm -rf
xargs
could control the batch size of an output. In this case, 50 elements in a batch/group, and pass to rm to process progressively.
Back to Table of Contents
Disclaimer
- License under
CC BY-NC 4.0
- Copyright issue feedback
me#imzye.com
, replace # with @ - Not all the commands and scripts are tested in production environment, use at your own risk
- No personal information is collected.
Feedback