Tip: Remove Long List of Files
How to delete long list of files in Linux?
Let’s say you have a long list of files that you want to delete and simply running rm -fv * just won’t work and Linux will let you know by giving you this error:
Argument list too long.
When you get this error, it means that the number of files is too many for the kernel to process.
There is a simple workaround for this.
By using xargs, you can pipe xargs into the command to process each output. This can be done like so:
ls | xargs rm -fv
This command will list all files in the working directory and execute delete without confirmation.
If it still returns the same error, you can use find and pipe xargs.
find . -type f | xargs rm -fv
The command find will search the current directory for all files, excluding directories, and delete without confirmation.
xargs is a versatile Linux and you can use the man page anytime if you want to know more.
man xargs
Related Posts
Post comment
Search PinoyTux
Subscribe to Email Feeds
Blog Lounge
Popular Posts
Recent Posts
Drop your Card Here
Recent Comments
- Eduardo Portillo on 3ix Scam: Looking for Feedbacks
- wayne donahue on Cebu Pacific Airlines is Evil!
- smeaferrepove on Howto: Install yum On RHEL 4
- Anidich1 on Tip: Add User and Generate Password Script
- Tom S on Cebu Pacific Sucks








