Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,336
Rep:
deleting millions of files at once
I have this folder with probably over 1 million small files, suprised it did not crash the filesystem due to the inode limit, but anyway, when I do a rm to delete them all, it errors out with -bash: /bin/rm: Argument list too long. Is there a quick way (other then formatting) to delete all these?
Assuming you want the folder and all its files gone:
rm -rf /path/to/folder
The reason you get argument list to long is that the shell expands wildcards like *. You can delete a few files at a time with rm [a-c]* for all file beginning with a, b, or c, which may put you under the limit.
As always, with rm and wildcards, be very very careful. Linux does not have an undelete.
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,336
Original Poster
Rep:
Thanks that for loop one worked. Never thought of doing that. Well would not have known how anyway. :P
Speaking of not being an undelete in linux, is there any utility you can get to restore files? or does deleting in linux actually destroy the file, unlike windows? Would be handy to have in case I ever goof up or something.
Last time I deleted something I should not (stupid console emulator from Konqueror!!!!) I found that in ext2 filesystems files can be restored, but in ext3 isn't possible because......well, bacause something i don't remember
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,336
Original Poster
Rep:
Quote:
Originally posted by RedDwarf Last time I deleted something I should not (stupid console emulator from Konqueror!!!!) I found that in ext2 filesystems files can be restored, but in ext3 isn't possible because......well, bacause something i don't remember
Yeah I figured, because of the journaling, it overrites quickly. Which sucks since beleive it or not I just just pulled it off on a folder while doing a cleanup. Typed the wrong folder name. Good thing it's stuff I can get back though. I was wondering why it was taking so long then suddently relized I typed the wrong folder. I must of hit CTRL+C at least 20 times.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.