add remove-old-packages.gmi

This commit is contained in:
Lee 2023-09-22 16:44:29 -04:00
parent 9aa2b59e0b
commit 7d982185b8
3 changed files with 102 additions and 0 deletions

View File

@ -58,6 +58,7 @@ This page is coded by hand and may occasionally miss an article. The full list c
## Linux
=> remove-old-packages.gmi How to remove old packages on Linux
=> why-cli.gmi 2023-07-31 - Why I use the command line
=> old-computer-recap.gmi 2023-07-17 - Old Computer Challenge 2023 Recap
=> void-pi.gmi 2023-07-14 - Setting Up Void Linux on an Old Raspberry Pi

View File

@ -28,6 +28,8 @@ This gemlog is best visited between 1am and 6am local time.
# Posts
=> remove-old-packages.gmi How to remove old packages on Linux
=> 1x1.gmi 2023-09-11 🎲 1x1: an e-zine of solo games
=> RE-students-on-gemini.gmi 2023-09-05 RE: Why would students use gemini?

99
remove-old-packages.gmi Normal file
View File

@ -0,0 +1,99 @@
# How to remove old packages on Linux
2023-09-21
This is a short Linux tutorial of incantations you can use to remove dependency packages for programs that you've uninstalled. As far as I know, this is not done automatically on any distros I've used. I tend to run this periodically, most especially after removing software from the command line. Most obviously, you'd do this to reduce your disk usage.
So here's how I remove old unused dependencies after I remove a package or program from my computer.
In general, autoremove means to remove no-longer needed dependencies. clean on Debian-based systems means to remove the deb dependency file listing and packages. If you are planning on reinstalling the software in the future, it's faster for your package manager to re-use the dependencies locally than re-download them. Personally, I don't need that.
### Debian, Ubuntu and derivatives
```
sudo apt autoremove && sudo apt clean
```
### Void Linux
I use the vpm package to easily install and remove software on Void Linux and this is what I do:
```
sudo vpm cleanup && sudo vpm autoremove
```
For straight up xbps without vpm I'd do the following:
```
xbps-remove -oO
```
This should be equivalent to the vpm commands above.
### Flatpak
In addition to Void's repos I use flatpak for software not found in my distro's repo. To remove unused dependencies you run:
```
sudo flatpak uninstall --unused
```
### Removing old kernels
This is Void-specific for me. After testing an updated kernel to make sure it's stable (have never had a problem on Void linux) I run the following to see which old kernel(s) I have installed:
```
vkpurge list
```
I usually leave one old kernel around just in case I ever have issue and need to use a previous kernel.
To remove an old kernel you run:
```
sudo vkpurge remove <kernel-number>
```
### Node.js npm package
To remove old unused dependencies of a project:
```
npm prune
```
### Python pip/pip3 packages
Like everything else with Python there is no single way to remove unused dependencies that I can see.
Annoyingly, it looks the most recommended way I've found is to install a new package, pip3-autoremove.
=> https://pypi.org/project/pip3-autoremove/ pip3-autoremove package
I'm not much of a python user and not a fan of its fractured dev enviornment so you'll want to look further into other solutions yourself.
### luarocks
See what luarocks packages you have installed:
```
luarocks list
```
Remove an individual rock:
```
luarocks remove --local <rockname>
```
Removing all installed rocks requires you specify the 'tree' explicitly:
```
luarocks purge --tree=~/.luarocks
```
=> ./index.gmi Back to index
---
If you have a comment you can email lettuce at the ctrl-c.club domain and please put comment and the post name and your handle.