I notice that whenever I use the command sudo apt-get -y autoremove quite a number of packages that I need is on the list to be removed.

After going through some of the posts on this forum, I have the impression that the command removes packages that have been automatically installed. To prevent autoremoval of a package, I will have to mark it as

sudo apt-get install <package-name>

Suppose I have 120 packages earmarked for autoremoval.

How do I mark them as manually installed with a single command?


Store all the packages which are ready for autoremoval in a text file and then run apt-mark manual command on those packages to mark it as manually installed.

for i in $(cat ~/Desktop/package.txt); do sudo apt-mark manual $i ; done

~/Desktop/package.txt - Contains the package names which are going to set as manually installed.

  • Thanks for the tip. As I do not have good IT knowledge, please tell me whether the command you gave is to be run in a normal terminal or root terminal? – n00b Mar 24 '14 at 17:04
  • normal terminal~$. – Avinash Raj Mar 24 '14 at 17:04

I am not sure you understand what autoremove is suggesting, from the man pages:


      autoremove is used to remove packages that were automatically
      installed to satisfy dependencies for other packages and are now no
      longer needed.


The are already installed, and thue "marked as installed", but they are not required as they are dependencies for packages you have already removed.

You should be able to remove them if you so desire, or leave them if you do not want to remove them.

If you feel you are having a problem, we would need further information about the packages you have installed / removed. Perhaps pastebin the list of packages autoremove wishes to remove?


Well, just do apt-get -s autoremove, copy the list of package from the terminal and paste it after sudo apt-get install.

  • Awesome! I didn't know it could be that simple :) – n00b Mar 25 '14 at 5:20

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.