Quantcast
Channel: esdrasbeleza.com » Sysadmin
Viewing all articles
Browse latest Browse all 4

Listing the packages on Debian/Ubuntu in one line

$
0
0

You can use dpkg to list all the packages that are selected on your Debian or Ubuntu system:

# dpkg --get-selections

But today I needed a way to list only the installed packages in just one line, so I could copy their names and use apt-get to install the same packages on another system. So I used the following command:

# dpkg --get-selections | grep "[ \t]*install$" | sed 's/[ \t]*install$//g' | awk 'BEGIN { packages = "" } { packages = packages " " $1 } END { print packages }'
acpi-support-base acpid adduser apt apt-utils [...] long list of packages [...] xsltproc xz-utils yelp zenity zlib1g zlib1g-dev

You can use the output above to easily install the same packages on another system using apt-get install <packages>.


Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles





Latest Images