Find and delete files greater than a given size from the Linux command line
https://www.zyxware.com/sites/default/files/styles/user_image/public/default_images/index.png?itok=2YmREnrP
BY Anoop John
6 years ago
Linux-Tips
0
comments comment

The find command available in GNU/Linux shells is a versatile tool for finding files matching the given conditions in a folder and performing a specific action on the files found. The following command will find all files greater than 1M size in your current folder and ask you if you would like to delete the file

find . -size +1M -exec rm -i {} \;

The following command will find all tar.gz files greater than 1M size and ask you whether you wish to delete them.

find . -size +1M -name "*.tar.gz" -exec rm -i {} \;

The following command will find all tar.gz files greater than 1M size and less than 20M size and ask you whether you wish to delete them.

find . -size +1M -name -size -20M "*.tar.gz" -exec rm -i {} \;

Find is an extremely powerful tool. To know more check out man find and read through the full set of offerings.


RELATED ARTICLE

close

on 27th July 2008 / by webmaster
We run apt-cacher to save bandwidth in our intranet. All Ubuntu systems in our office uses the apt-cacher server to update and upgrade. Recently we started getting the hash sum mismatch and size mismatch errors. After some dabbling with the settings and the files we figured out a simple solution for this problem. Whenever we were running apt-get update, apt-get upgrade or apt-get dist-upgrade we were getting these annoying show-stoppers. The exact errors we were receiving were of this form W: Failed to fetch http://192.168.1.5:3142/ubuntu/..i386.deb Hash Sum mismatch or W: Failed to fetch http://192.168.1.5:3142/ubuntu/...deb Size mismatch Once we started getting this error for a package in one of the machines in the network, it reoccurred for the same packet on all the other machines in the network. So we figured that it had something to do with the apt-cacher and we forced a reload of the specific package by going to the apt-cacher repository(we have it at the default location - /var/cache/apt-cacher) and deleting the file with the name for which the error was triggered from within the var/cache/apt-cacher/private folder. This file is a flag which is used to indicate the download status of the specific package. While doing research on this problem we also realized that a possible solution was to change the repository server to some other server than the one already setup, either manually by editing the sources.list file or by changing it from synaptic package manager. This was how we initially solved the problem to get going but we have a lot of systems and we had only limited bandwidth and we had to save the bandwidth. We also realized that we started getting this problem once we setup the apt-cacher with expiry-time of 24 hours. It could possibly have been that the packages were updated in between and our cache had gotten stale. So a similar issue could happen when people use proxies or apt-on-cds for updating packages. Once we fixed the errors we set the expiry-time to 0 which meant that new packages.gz files are downloaded every time someone requested for an update/upgrade. Hope this helps. Zyxware is a leading Drupal web development company in India which has its operations in US, UK, Canada, Australia and Middle East. We provide all kind of Drupal services including Drupal Commerce. If you have any query regarding this, please get in touch with us Linux System Administration Ubuntu Linux Tips Leave a reply Your email address will not be published. Required fields are marker * Atomymous (not verified) access_time 19 Feb 2019 - 04:37 I found this article because I was experiencing the same problem. My case turned out to be because, here at work, I'm behind the corporate firewall and needed to configure apt-get to use the proxy server (in Synaptic Package Manager -> Settings -> Network tab) george (not verified) access_time 19 Feb 2019 - 04:37 In reply to Same misleading error for proxy problem by Atomymous (not verified) i am running ubuntu 8 at home, desktop. i keep getting fetch fail, hash sum mismatch from updates. do you think the above fix will work and if so could you generate a step by step walkthrough as i am new to linux and command line use. george Nigel Horne (not verified) access_time 19 Feb 2019 - 04:37 You also need to check if you're running Dans Guardian. That software stops you updating your system. sadeed86 (not verified) access_time 19 Feb 2019 - 04:37 try updating any package using the same source..for example, if u r using lock info which is downloaded from insanelyi, adding more plug in such as weather plug in must be from the same source from insanelyi as well...the same apps from different source has different packages, thats why updating or plugging in show some error... claive alvin p… (not verified) access_time 19 Feb 2019 - 04:37 su to root, then #rm -f /var/cache/apt/partial/* #rm -f /var/cache/apt/*.deb *Do not remove the partial folder under /var/cache/apt I saw this at http://paulpodolny.blogspot.com/2011/06/ubuntu-hash-sum-mismatch-workar… Pagination Current page 1 Page 2 Next page Next › Last page Last » Add new comment
more_horiz
close

on 03rd June 2009 / by webmaster
If you are a regular GNU Linux user there is a very good chance that you will come across emails forwarded to you as .eml files once in a while. .eml is the extension used for files saved as emails from Microsoft outlook or outlook Express. It is normally just a matter of opening these files with gedit as the files are plain text files unless they have attachments. If the attached .eml files themselves have attachments you run into the problem of actually having to open these base64 encoded attachments. The default set of applications in Ubuntu does not directly allow you to do this but there is an easy work around for this problem. Open evolution and compose a new mail. Attach the .eml file as an attachment to this mail. Save the mail and close the compose window. Select the mail from the Evolution main window. Below the viewing pane there will be an option to view the attachment inline. Click on it and enjoy. This is only a workaround for the problem but it is an easy work around. If you know an easier solution please do share it with us for the benefit of everybody out there. Ubuntu Free Software Linux Tips GNU Linux Leave a reply Your email address will not be published. Required fields are marker * Anonymous (not verified) access_time 19 Feb 2019 - 04:37 This tip works very nice on emails where you receive an .eml file as attachment in evolution as well. Only have to scroll down in the message (or viewing pane) to find the option as described. So far I did find only conversion tips by storing the .eml and converting it through Thunderbird till now. Thanx Giannis natsos (not verified) access_time 19 Feb 2019 - 04:37 Open evolution and compose a new mail. Attach the .eml file as an attachment to this mail. Save the mail and close the compose window. Select the mail from the Evolution main window. Below the viewing pane there will be an option to view the attachment inline.download kMail.With left click select KMail. Click on it and enjoy. A.M. (not verified) access_time 19 Feb 2019 - 04:37 Thank you very much, it works! :) jamesc (not verified) access_time 19 Feb 2019 - 04:37 1. From Thunderbird/Evolution/gmail/wherever: Save message (as .eml). 2. $ sudo apt-get install mpack # or equivalent for your OS - install package called "mpack" 3. $ munpack message.eml # bash, multiple files: $ for f in *.eml; do munpack $f; done enzostra (not verified) access_time 19 Feb 2019 - 04:37 In reply to view .eml files (and unpack MIME encoded attachments) by jamesc (not verified) Very useful. It works very well! Thanks. Pagination Current page 1 Page 2 Next page Next › Last page Last » Add new comment
more_horiz
close

on 14th July 2009 / by webmaster
Rar used to be a favorite compression format when the compressed files were to be split into multiple pieces to fit into legacy external storage devices like Floppy, Zip disk, CD etc. WinRAR is a popular GUI application that can rar and unrar files in the rar format. If however you come across rar files that are split into multiple parts then you can extract and combine them as follows unrar x -e file.part1.rar The other parts have to be in the same folder. The unrar utility will find these other parts and then use them to extract the original file from the split archive. If the rar and unrar utilities are not present in your system you can install them by running sudo apt-get install rar unrar Happy Unraring :-) Ubuntu Linux Tips GNU Linux Leave a reply Your email address will not be published. Required fields are marker * Anonymous (not verified) access_time 19 Feb 2019 - 04:37 Thanks! DanielRemains (not verified) access_time 19 Feb 2019 - 04:37 Sometimes it's 'part01.rar' and not 'part1.rar'. Thanks for this guide! Pedro (not verified) access_time 19 Feb 2019 - 04:37 Thanks Yasser Zamani (not verified) access_time 19 Feb 2019 - 04:37 Hi, Today when I tried to extract by "Right-Click --> Extract here", it did not work but fortunately I done it in the way you said! Thank you very much! Anonymous (not verified) access_time 19 Feb 2019 - 04:37 :) Pagination Current page 1 Page 2 Next page Next › Last page Last » Add new comment
Leave a reply
Your email address will not be published. Required fields are marker *

Filtered HTML

  • Web page addresses and email addresses turn into links automatically.
  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type='1 A I'> <li> <dl> <dt> <dd> <h2 id='jump-*'> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
The content of this field is kept private and will not be shown publicly.
CAPTCHA This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.