brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: apt-mark showmanual lists what you installed yourself

Apt
~/tips/tip-apt-apt-mark-showmanual-list

apt-mark showmanual > packages.txt

Prints the packages you installed on purpose, which makes rebuilds easier.

When I rebuild a server, I want the packages I chose, not the hundreds that arrived as dependencies.

apt-mark showmanual > packages.txt
xargs -a packages.txt sudo apt install -y

apt records whether a package was requested by a person or pulled in as a dependency. showmanual prints the first group, showauto the second and showhold the held ones. A fresh Ubuntu install already has many manual packages from the installer, so the list starts long. Open packages.txt and trim it before you feed it to apt install, because it can name packages that do not exist on the new release. apt-mark auto marks a package as a dependency so that autoremove can clean it up.

Further reading: apt-mark manual page

More Apt tips sudo apt-mark minimize-manual apt list '~c' grep -E ' (install|upgrade|remove) ' /var/log/dpkg.log | tail -o Dpkg::Options::="–force-confold" upgrade sudo apt-get -d -y full-upgrade All Apt tips (42) All topics

Link