# Clean and remove unnecessary software from the system?



## teo (Aug 28, 2019)

Any application or script that does the system cleaning function and removes obsolete unnecessary software that does not use the system?  And not manually with the commands `pkg clean`, `pkg autoremove` , `pkg clean -a` or `portsclean -CDD`.


----------



## SirDice (Aug 28, 2019)

How would the system be able to tell if the software is unnecessary? It can't. That's up to you. And so, it's also up to you to remove anything that's not needed.

Note that neither `pkg clean` or `portsclean` remove any installed software. The pkg-clean(8) only removes locally cached (i.e. downloaded) packages. It doesn't touch anything that's installed.


----------



## teo (Aug 28, 2019)

SirDice said:


> How would the system be able to tell if the software is unnecessary? It can't. That's up to you. And so, it's also up to you to remove anything that's not needed.
> 
> Note that neither `pkg clean` or `portsclean` remove any installed software. The pkg-clean(8) only removes locally cached (i.e. downloaded) packages. It doesn't touch anything that's installed.


And backups do not delete by means of those commands? I understood that any dependence on older versions of unused or uninstall packages (software), the system cleaned it with those commands.


----------



## SirDice (Aug 28, 2019)

teo said:


> And backups do not delete by means of those commands?


pkg-clean(8) only removes files from /var/cache/pkg/. These are locally cached files from previous invocations of pkg-install(8) or pkg-upgrade(8).


----------



## rigoletto@ (Aug 28, 2019)

pkg-autoremove(8) will remove packages installed automatically as a dependency of another package which are not necessary anymore. The better way to keep the system clean of unnecessary packages is keeping just the packages you actually need and use as origin packages.

You can run `pkg prime-list` to get the origins. If there is something you don't use/need run `pkg set -A1 pkgname`, and then `pkg autoremove` to remove what is not a dependency of something.


----------

