112

I'm not sure what sudo apt-get autoremove does, but have read that you should use this command to remove any unnecessary packages.

One of the processes I saw was to use sudo apt-get autoremove and then use something like BleachBit to remove temp files etc.

Can you explain what sudo apt-get autoremove actually does and is there any advantages of using this command over something like BleachBit or Ubuntu Tweak janitor by themselves?

2 Answers 2

139

what sudo apt-get autoremove actually does

Whenever you install an application (using apt-get) the system will also install the software that this application depends on. It is common in Ubuntu/Linux that applications share the same libraries. When you remove the application the dependency will stay on your system.

So apt-get autoremove will remove those dependencies that were installed with applications and are no longer used by anything else on the system.

is there any advantages of using this command over something like Bleachbit or Ubuntu Tweak janitor?

  • Bleachbit or Ubuntu Tweak janitor are graphical interfaces.
  • sudo apt-get autoremove is a command

Using one option does not exclude the other: I would assume BB and UTJ use sudo apt-get autoremove (in some sort of way) to remove dependencies. So it is not a question of "any advantages." It is a matter of preference: are you a command line type of person or are you a GUI type of person?

By the way: deborphan is another tool to clean your system.

1
  • Thank you for sharing this. In my own experience running sudo apt-get autoremove is safer than using something like Bleachbit, i (and a friend of mine) have run into problems after using Bleachbit. Just running sudo apt-get autoremove seems safer to me. Though i guess it also depends on how you configure your cleaning inside Bleachbit (there are a lot of options presented with checkboxes for what you want to clean up)
    – sunyata
    Jul 13, 2017 at 16:52
14

One minor addition: Since 14.04 you may actually write apt autoremove to remove packages that were automatically installed to satisfy dependencies for other packages and are now no longer needed as dependencies.

These two commands are equivalent:

  • apt autoremove
  • apt-get autoremove
1
  • 8
    I'm super late to this party here @matt, but I believe you're meant to use apt interactively, and specifically not meant to use apt in scripts. The apt-get command (and other apt-* commands) are designed to have stable behavior in the long term, whereas apt is intended to be simpler and more user-friendly, and will continue to evolve or change in ways that humans like. Specifically, they've said that '[apt's] output may be changed between versions' so that's one reason you should avoid it in scripts if you care about the output.
    – XP84
    Feb 20, 2020 at 20:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .