• Welcome to Peterborough Linux User Group (Canada) Forum.
 

Get back hard drive space with 'apt autoremove'

Started by Jason, December 19, 2020, 05:44:44 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Jason

I've noticed that graphical update tools seem to leave old packages on the system that aren't necessary. Linux Lite does, for example. You can get back some space by removing them. I just got back 2 GB worth! For me, that's pretty helpful on a 128 GB drive. To find how much space you've saved, enter this command before and after removing these extraneous files:

df -h

Note the drive space used on the filesystem mounted on /.

Then, to find out if there are packages you no longer need and to remove them, enter this command in the terminal:

sudo apt autoremove

Old kernel packages tend to be the main packages sucking up hard drive space.

And btw, you're notified of these redundant packages when you run 'sudo apt full-upgrade' along with the command to remove them.

Let us know how much, if any, drive space you get back using 'apt autoremove'.
* Zorin OS 17.1 Core and Windows 11 Pro on a Dell Precision 3630 Tower with an
i5-8600 3.1 GHz 6-core processor, dual 22" displays, 16 GB of RAM, 512 GB Nvme and a Geforce 1060 6 GB card
* Motorola Edge (2022) phone with Android 13

fox

Zero for me. That's because I run "sudo apt autoremove" after every kernel update.  :)
Ubuntu 24.10 on 2019 5k iMac
Ubuntu 24.04 on Dell XPS 13

ssfc72

15 G savings for me.  Thanks Jason, for this valuable tip!

The PLUG Forums are sure a great resource for people like me, who are not as skilled at using Linux, and can get tips like this from other expert Linux users, on these Forums.
Mint 20.3 on a Dell 14" Inspiron notebook, HP Pavilion X360, 11" k120ca notebook (Linux Lubuntu), Dell 13" XPS notebook computer (MXLinux)
Cellphone Samsung A50, Koodo pre paid service

Jason

Quote from: fox on December 19, 2020, 10:40:33 PM
Zero for me. That's because I run "sudo apt autoremove" after every kernel update.  :)

So those kernel packages take up zero space before you run the command? I think not. :) Kernel updates don't happen as often as updates for other packages so if you run it after every kernel update, you'll sweep up all the other packages that are left, too, resulting in not much space saved but it has to be more than zero or there'd be no point in running it at all.
* Zorin OS 17.1 Core and Windows 11 Pro on a Dell Precision 3630 Tower with an
i5-8600 3.1 GHz 6-core processor, dual 22" displays, 16 GB of RAM, 512 GB Nvme and a Geforce 1060 6 GB card
* Motorola Edge (2022) phone with Android 13

Jason

Quote from: ssfc72 on December 20, 2020, 12:40:12 AM
15 G savings for me.  Thanks Jason, for this valuable tip!

The PLUG Forums are sure a great resource for people like me, who are not as skilled at using Linux, and can get tips like this from other expert Linux users, on these Forums.

I think you're pretty skilled at Linux but there are always new things you, or I, can learn.
* Zorin OS 17.1 Core and Windows 11 Pro on a Dell Precision 3630 Tower with an
i5-8600 3.1 GHz 6-core processor, dual 22" displays, 16 GB of RAM, 512 GB Nvme and a Geforce 1060 6 GB card
* Motorola Edge (2022) phone with Android 13

fox

Quote from: Jason Wallwork on December 20, 2020, 02:25:26 AM
So those kernel packages take up zero space before you run the command? I think not. :) Kernel updates don't happen as often as updates for other packages so if you run it after every kernel update, you'll sweep up all the other packages that are left, too, resulting in not much space saved but it has to be more than zero or there'd be no point in running it at all.
I think we're arguing semantics here. I save about 340 mb by running autoremove, with most of the saving being the removal of the oldest kernel. I interpreted your suggestion as running the set of commands "now", which I did, and there was no further saving.
Ubuntu 24.10 on 2019 5k iMac
Ubuntu 24.04 on Dell XPS 13