Peterborough Linux User Group (Canada) Forum

Linux & Android => Articles, Tutorials and Tips => Topic started by: Jason on December 19, 2020, 05:44:44 PM

Title: Get back hard drive space with 'apt autoremove'
Post by: Jason on December 19, 2020, 05:44:44 PM
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'.
Title: Re: Get back hard drive space with 'apt autoremove'
Post by: fox on December 19, 2020, 10:40:33 PM
Zero for me. That's because I run "sudo apt autoremove" after every kernel update.  :)
Title: Re: Get back hard drive space with 'apt autoremove'
Post by: 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.
Title: Re: Get back hard drive space with 'apt autoremove'
Post by: Jason on December 20, 2020, 02:25:26 AM
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.
Title: Re: Get back hard drive space with 'apt autoremove'
Post by: Jason on December 20, 2020, 02:26:03 AM
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.
Title: Re: Get back hard drive space with 'apt autoremove'
Post by: fox on December 20, 2020, 07:32:15 AM
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.