Skip to content

Instantly share code, notes, and snippets.

@peteruithoven
Last active October 30, 2018 15:34
Show Gist options
  • Save peteruithoven/9daf94a299031793c1505ea6285f348f to your computer and use it in GitHub Desktop.
Save peteruithoven/9daf94a299031793c1505ea6285f348f to your computer and use it in GitHub Desktop.
List info on installed applications (Read only)
#!/bin/bash
# Download and run:
# curl -o- [raw gist url] | bash
function list_installed () {
comm -23 \
<(apt-mark showmanual | sort -u) \
<(gzip -dc /var/log/installer/initial-status.gz | sed -n 's/^Package: //p' | sort -u)
}
echo "# Sources:"
grep -r --include '*.list' '^deb ' /etc/apt/ | \
grep -v 'ubuntu.com' | \
grep -v 'launchpad.net/elementary-os' | \
grep -v 'elementary.io' | \
sed -re 's/^\/etc\/apt\/sources\.list((\.d\/)?|(:)?)//' \
-e 's/(.*\.list):/\[\1\] /' \
-e 's/deb http:\/\/ppa.launchpad.net\/(.*?)\/ubuntu .*/ppa:\1/'
echo ""
echo "# Manually installed packages:"
list_installed
echo ""
echo "sudo apt install $(list_installed | tr '\n' ' ')"
echo ""
echo "# Snaps:"
snap list
echo ""
echo "Install:"
echo "$ snap install [app id]"
echo ""
echo "# Flatpak remotes:"
flatpak remotes -d
echo ""
echo "Add remote:"
echo "$ flatpak remote-add --if-not-exists [name] [url]"
echo ""
echo "# Flatpak installed:"
flatpak list -d
echo ""
echo "Install: "
echo "$ flatpak install [remote] [app id]"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment