In this article, I will take you through 2 different ways that can be used to list all manually installed packages in Ubuntu/Debian. Many times you might want to know about all the packages which are automatically installed due to some dependency requirements from another package and also about the packages which you have manually installed. While there are multiple ways to find all those packages but here we will look into 2 simple ways that can be easily used to find out all the manually installed packages. We will see about automatically installed packages in upcoming articles.
2 Ways to List All Manually Installed Packages in Ubuntu/Debian
Also Read: How to Prevent Updating a Specific Package in Linux(Ubuntu/Debian)
Method 1: Using apt or apt-get command
If you are using older Ubuntu/Debian version then you can use apt or apt-get command to check all the manually installed packages in Ubuntu/Debian. You need to run
apt list --manual-installed=true command to check all the manually installed packages. More about apt command.
rootuser to run all the below commands. You can use any user with
sudoaccess to run all these commands. For more information Please check Step by Step: How to Add User to Sudoers to provide
sudoaccess to the User.
root@debian:~# apt list --manual-installed=true Listing... Done adduser/stable,now 3.118 all [installed] apt-listchanges/stable,now 3.24 all [installed] apt-utils/stable,now 2.2.4 amd64 [installed] apt/stable,now 2.2.4 amd64 [installed] base-files/stable,now 11.1 amd64 [installed] base-passwd/stable,now 3.5.51 amd64 [installed] bash-completion/stable,now 1:2.11-2 all [installed] bash/stable,now 5.1-2+b3 amd64 [installed] bind9-dnsutils/stable,now 1:9.16.15-1 amd64 [installed] bind9-host/stable,now 1:9.16.15-1 amd64 [installed] bsdutils/stable,now 1:2.36.1-8 amd64 [installed] busybox/stable,now 1:1.30.1-6+b3 amd64 [installed] bzip2/stable,now 1.0.8-4 amd64 [installed] ca-certificates/stable,now 20210119 all [installed] console-setup/stable,now 1.205 all [installed] coreutils/stable,now 8.32-4+b1 amd64 [installed] cpio/stable,now 2.13+dfsg-4 amd64 [installed]
Method 2: Using apt-mark command
If you are using latest Ubuntu/Debian version then you can also use apt-mark command to check all the manually installed packages. You just need to run
apt-mark showmanual command to check that as you can see below.
root@debian:~# apt-mark showmanual adduser apt apt-listchanges apt-utils base-files base-passwd bash bash-completion bind9-dnsutils bind9-host bsdutils busybox bzip2 ca-certificates console-setup coreutils
2 thoughts on “2 Ways to List All Manually Installed Packages in Ubuntu/Debian”
"I am using root user to run all the below commands. You can use any user with sudo access to run all these commands"
Why are you running them as root? None of them require root access to run. Best practices would generally be to follow least privilege principle ... so nor running stuff as root when that's not required.
You are absolutely correct. Ideally one does not need sudo or root access to run above mentioned commands but sometimes when you are working in a security hardened environment then apt or apt-get command does not work properly with non-privileged user. Hence thinking of that scenario as well, in general I have recommended to use sudo access to run the given commands. Otherwise it is up to user to decide how he/she want to run any command based on local server access and security guidelines.
Regarding usage of root access, here I just shown the ways to list all the manually installed packages in my demo system where I usually like to run all the commands using root access(one of my old habit). But yes you are correct just to avoid the confusion, probably I should not be using root access even in my demo system.
Thanks for your input anyway !!