I have many packages that are marked as autoremovable. I want to mark them as manually-installed, so that they are no longer autoremovable.

I can do it one package at-a-time using

sudo apt-mark manual <package name>

But how can I do it for all of the packages in one go, without typing all of the package names.

An answer to this question describes how to mark all automatically-installed packages as manually-installed, but I want to mark only the autoremovable packages.

1 Answer 1


You can specify multiple package names as arguments to apt-mark manual:

sudo apt-mark manual package1 package2 package3

This will mark all those packages as manually installed.


sudo apt-mark manual $(sudo apt-get -s autoremove 2>/dev/null | awk '/^Remv / { print $2 }')

will mark all packages which are auto-removable as manually installed.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.