Generating list of programs installed - how?

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
Martin1001
Level 4
Level 4
Posts: 406
Joined: Sat Mar 28, 2020 7:19 am
Location: Plymouth, UK

Generating list of programs installed - how?

Post by Martin1001 »

Just received a message telling me that Mint 19.3 soon won't be supported and I need to replace with 21.1.

I know how to set up a live Mint USB, how to install onto my laptop from that, and I maintain a separate backup of all my files.

I've been keeping a list on paper of the programs I've installed while using Mint 19.3---all of them via Software Manager, and used without modification---but, as a check, is there a simple way to generate a neat list of the programs that I installed?
Last edited by LockBot on Wed Jul 26, 2023 10:00 pm, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Linux Mint 21.2 Cinnamon. 15.6 GiB. 1001.3 GB. Lenovo Thinkpad.
User avatar
spamegg
Level 14
Level 14
Posts: 5094
Joined: Mon Oct 28, 2019 2:34 am
Contact:

Re: Generating list of programs installed - how?

Post by spamegg »

Software Manager has that option but it's graphical:
Untitled.png
Not sure how that can be piped into a text file in list form.

There is this, but it shows all the packages, not just programs:

Code: Select all

apt list --installed > packages.txt
I'd recommend keeping that list in a text file from now on, instead of paper.
mikeflan
Level 17
Level 17
Posts: 7143
Joined: Sun Apr 26, 2020 9:28 am
Location: Houston, TX

Re: Generating list of programs installed - how?

Post by mikeflan »

This is probably the best list:

Code: Select all

dpkg --get-selections > ~/Documents/installed-softwareMint.list
Other options to get a list of installed programs:
This one produces almost the same list as the command above:

Code: Select all

find /usr/share/applications -maxdepth 1 -type f -exec basename {} .desktop \; | sort > ~/Desktop/applications.txt
or

Code: Select all

comm -23 <(apt-mark showmanual | sort -u) <(gzip -dc /var/log/installer/initial-status.gz | sed -n 's/^Package: //p' | sort -u)
or

Code: Select all

dpkg-query -l [This is a very long list - output to file " > dpkg.txt"]
This is not a complete listing. I.e. QGIS and Skype are not listed.

Code: Select all

ls /usr/share/applications | awk -F '.desktop' ' { print $1}' - > ~/Desktop/applications.txt
This lists programs that are running right now:

Code: Select all

wmctrl -lx
User avatar
zcot
Level 9
Level 9
Posts: 2838
Joined: Wed Oct 19, 2016 6:08 pm

Re: Generating list of programs installed - how?

Post by zcot »

First off, you don't have to go to 21.1(EOL is April 2027), you can go up to any of the Mint 20.x versions, they are still supported until April 2025.

I find the Backup Tool listing is quite good after years through the versions. It used to not show ppa software, or manually installed from terminal, but it does now. I don't know how much of that is backported for older versions, possibly all the good parts though, but at least it works nicely on 20.x and above.

Check out that Backup Tool in the main menu, get the Software Selection, and it will make the text file in your home directory under ~/Documents/Backups/ and you could also bring that file to the new install, same path location and it will automate that list of installs(it will not go get ppa sources and add those but if you readd the sources it will be able to pull the software).

For me comparing that list with the com 23 line mentioned above, it's nearly exact, except that the com 23 line is also showing some additional packages from the dependencies of the others in the list, -but the theory is that if you install the 1 program again, it will still pull those dependencies automatically anyway(although it depends on the difference of the apt configuration with --install-recommends --install-suggests, but then Mint 20 and 21 do have install-recommends as default).
sjmathis
Level 3
Level 3
Posts: 115
Joined: Sun Dec 11, 2016 8:22 pm

Re: Generating list of programs installed - how?

Post by sjmathis »

I have the same problem, but I don't have a list of things I installed on paper. I tried the suggested approaches, but they generate over 2500 lines in their listings. So can I suggest a modification of the question: what programs have I installed, which are NOT part of the default Mint installation of 19.3? Note emphasis on "I".

I first hit this issue when I was trying to figure out what to back up. I knew I had to back up Documents, Desktop, Music and so on. Then I discovered that I had a Calibre directory, and I started wondering what else I had to worry about that wasn't in the usual places that Mint creates for you. Now I'm wondering about what happens when I try to upgrade to the next version of Mint. Do I have to worry about the version of Calibre, so that when I upgrade and install a new version of it, does it still work with my old directory?
rickNS
Level 9
Level 9
Posts: 2973
Joined: Tue Jan 25, 2011 11:59 pm

Re: Generating list of programs installed - how?

Post by rickNS »

sjmathis wrote: Thu Jan 26, 2023 1:19 pm I tried the suggested approaches, but they generate over 2500 lines in their listings. So can I suggest a modification of the question: what programs have I installed, which are NOT part of the default Mint installation of 19.3? Note emphasis on "I".

The backup tool @zcot mentions does not produce any 2500 lines.
As for a command, this one, (a modified version of one from above) eliminates all the lib* packages, so shortens the list considerably.

Code: Select all

comm -23 <(apt-mark showmanual | sort -u) <(gzip -dc /var/log/installer/initial-status.gz | sed -n 's/^Package: //p' | sort -u) | grep -Ev ^lib
Mint 20.0, and 21.0 MATE on Thinkpads, 3 X T420, T450, T470, and X200
Martin1001
Level 4
Level 4
Posts: 406
Joined: Sat Mar 28, 2020 7:19 am
Location: Plymouth, UK

Re: Generating list of programs installed - how?

Post by Martin1001 »

spamegg wrote: Thu Jan 26, 2023 11:09 am Software Manager has that option but it's graphical:
That I find really useful. It showed three files that the other versions referred to below failed to pick up. But, as was pointed out, there's seems to be no possibility of getting a list to output. However, a solution to that problem a bit further on below**.
zcot wrote: Thu Jan 26, 2023 12:58 pm First off, you don't have to go to 21.1(EOL is April 2027), you can go up to any of the Mint 20.x versions, they are still supported until April 2025.
Why might one not want to go all the way to 21.1, and install a 20.x instead?
zcot wrote: Thu Jan 26, 2023 12:58 pm I find the Backup Tool listing is quite good after years through the versions. [...] Check out that Backup Tool in the main menu, get the Software Selection, and it will make the text file in your home directory under ~/Documents/Backups/ and you could also bring that file to the new install, same path location and it will automate that list of installs(it will not go get ppa sources and add those but if you readd the sources it will be able to pull the software).

For me comparing that list with the com 23 line mentioned above, it's nearly exact, except that the com 23 line is also showing some additional packages from the dependencies of the others in the list, -but the theory is that if you install the 1 program again, it will still pull those dependencies automatically anyway(although it depends on the difference of the apt configuration with --install-recommends --install-suggests, but then Mint 20 and 21 do have install-recommends as default).
Yes, also very useful, and I found the same comparing with the com 23 line. **Also, since it gives a list for output, one can add by hand the additional things picked up by Software Manager> Show Installed Applications.
sjmathis wrote: Thu Jan 26, 2023 1:19 pm Then I discovered that I had a Calibre directory
I hadn't noticed that till you pointed it out. I think, though I'm no expert but have used Calibre quite a bit, that as long as one has stored one's created files somewhere safe, it won't matter if that directory disappears on reinstalling Mint. But perhaps you use Calibre in quite a different way from me, so don't rely on what I say!
Linux Mint 21.2 Cinnamon. 15.6 GiB. 1001.3 GB. Lenovo Thinkpad.
mikeflan
Level 17
Level 17
Posts: 7143
Joined: Sun Apr 26, 2020 9:28 am
Location: Houston, TX

Re: Generating list of programs installed - how?

Post by mikeflan »

Why might one not want to go all the way to 21.1, and install a 20.x instead?
There could be a lot of reasons, but basically it often boils down to 20.x working better than 21.1.
Martin1001
Level 4
Level 4
Posts: 406
Joined: Sat Mar 28, 2020 7:19 am
Location: Plymouth, UK

Re: Generating list of programs installed - how?

Post by Martin1001 »

mikeflan wrote: Thu Jan 26, 2023 5:02 pm
Why might one not want to go all the way to 21.1, and install a 20.x instead?
There could be a lot of reasons, but basically it often boils down to 20.x working better than 21.1.
That's an excellent reason not to! I'll take your advice. Thank you.
Linux Mint 21.2 Cinnamon. 15.6 GiB. 1001.3 GB. Lenovo Thinkpad.
User avatar
Koentje
Level 7
Level 7
Posts: 1578
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: Generating list of programs installed - how?

Post by Koentje »

Maybe it's useful?

Code: Select all

#!/bin/bash
########################################################################
#                                                                      #
#  Small script that lists all installed packages. Double click on     #
#  a package shows package info and a link to the package homepage.    #
#  "Save to file" saves the list to text file without the lib packages #
#  Only tested on Mint 19 & 20.                                        #
#  Depends on: apt, dpkg, yad and an internet browser                  #
#                                                                      #
#  Made by Koentje  (lowrida007@gmail.com                              #
#                                                        version 1.4   #
########################################################################

arch=`dpkg --print-architecture`


# Open homepage url of package in browser
function open_file {
   xdg-open "$url"
}
export -f open_file


# Open package informationn dialog
function info_dialog () {
 $HOME/bin/mousepointer hourglass
 tmpfile="/tmp/yad-show-package.tmp"
 dialog_width="1150"
 dialog_height="570"
 dialog_font="Ubuntu Mono 13"
 apt-cache show "$2" > "$tmpfile"
 export url=$(cat "$tmpfile" | grep "Homepage:" | head -n1 | awk '{print $2}')
 export package=$(cat "$tmpfile" | grep "Package: " | awk '{print $2}')
  if ! [ "$url" = "" ]; then buttonhomepage="--button=Website:bash -c open_file"; fi
 $HOME/bin/mousepointer default

 cat $tmpfile | yad --text-info --margins=6 --back=#181818\
 --title=" Package info:  $package "\
 --center --fixed --wrap\
 --tail --always-print-result\
 --fontname="$dialog_font"\
 --text-align=left\
 --width="$dialog_width" --height="$dialog_height"\
 --buttons-layout=spread\
 --button="OK" \
 "$buttonhomepage"
}
export -f info_dialog


# Open main form with all installed packages
function main () {
 main_width="1900"
 main_height="800"
 export input
 input=$(dpkg -l | sort -fbn | tail -n +4 | grep -F "ii" | awk -F" "  '{ printf $1"\n" $2"\n" $3"\n" $4"\n"; $1=$2=$3=$4=""; printf substr($0,5)"\n" }' | tr "'" " " | yad --list\
 --width="$main_width" --height="$main_height"\
 --title=" Show installed packages - ($arch)  "\
 --separator=' '\
 --window-icon=utilities-system-monitor\
 --center --vscoll-policy=always\
 --window-icon=application\
 --text-align=left\
 --button="Safe2File"!gtk-execute!" Save list to file (without lib packages) ":200\
 --button="gtk-close"!gtk-close!" Bye.. ":202\
 --buttons-layout=spread\
 --dclick-action="bash -c 'info_dialog %s'"\
 --add-preview\
 --column-width=10 --grid-lines=both --expand-column=100 --no-markup\
 --column="Inst:TEXT"\
 --column="Package name:TEXT"\
 --column="Version number:TEXT"\
 --column="Platform:TEXT"\
 --column="Short description:TEXT") #"

 case $? in
   200)		# Cancel
    echo "Save package list to  $HOME/installed-software.txt"
    comm -23 <(apt-mark showmanual | sort -u) <(gzip -dc /var/log/installer/initial-status.gz | sed -n 's/^Package: //p' | sort -u) | grep -Ev ^lib > "$HOME/installed-software.txt"
    xdg-open "$HOME/installed-software.txt"
    main
   ;;
   202)		# Cancel
    echo "Program halted."
    exit
   ;;
   252)		# Escape exit
    echo "Escaped."
    exit
   ;;
   *)
    echo "Exit nr: $1"
   ;;
 esac
}

main

Locked

Return to “Beginner Questions”