Get list of the installed packages from debian distributions for documentation

When documenting my server installation I needed to have a list of packages installed on my server. dpkg –get-selections is great help but it returns values/packages each on separate line including “installed” keyword. This command returns list of installed packages in the single block separated with single space:

dpkg --get-selections | awk '{ print $1; }'| tr "\n" " "

Explanation:

dpkg --get-selections - this commands outputs list of installed packages ( debian package management ONLY)
awk '{ print $1; }' - get a first column from dpkg output
tr "\n" " " - replace new line character ( \n ) with space

Leave a Reply

You must be logged in to post a comment.