Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save JCookTW/fe445035aba2dc855ed6a59e99096e96 to your computer and use it in GitHub Desktop.

Select an option

Save JCookTW/fe445035aba2dc855ed6a59e99096e96 to your computer and use it in GitHub Desktop.
This shell script lists ALL the packages installed on any Linux system that uses dpkg for package management such as Debian, Ubuntu, Kubuntu, Xubuntu, Lubuntu, Linux Mint, Kali Linux, Bodhi Linux, etc.
#!/bin/bash
# COPYRIGHT: That Mahesh RS (https://sites.google.com/site/thatmaheshrs)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# ---- README ----
# this script shows a list of all installed packages
# it SHOULD work on most Debian/Ubuntu derivatives
# install this script in /usr/local/bin
# then chmod +x this script
dpkg-query -l | grep '^ii' | awk '{print $2}'
# here is how to understand that pipeline:
# this command list all packages: "dpkg-query -l"
# ... but it is intelligent enough to mark installed packages with "ii"
# ... so we search for ONLY INSTALLED packages with this part of the pipe: "| grep '^ii'"
# ... but that gives out a lot of info about the package which we are not interested in
# ... so we pull out the package name using this part of the pipe: "| awk '{print $2}'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment