TangentFox

List installed software (Linux, Ubuntu)

Aug 18th, 2018 (edited)
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.89 KB | None | 0 0
  1. #!/usr/bin/env bash
  2. # Lists items into individual files in working directory
  3. #   PPAs (ppas)
  4. #   user-installed apt packages (debs)
  5. #   snap packages (snaps)
  6. #   LuaRocks' rocks (rocks)
  7. #   Flatpak apps (flatpaks)
  8.  
  9. list_ppas () {
  10.   for APT in `find /etc/apt/ -name \*.list`; do
  11.     grep -o "^deb http://ppa.launchpad.net/[a-z0-9\-]\+/[a-z0-9\-]\+" $APT | while read ENTRY ; do
  12.       USER=`echo $ENTRY | cut -d/ -f4`
  13.       PPA=`echo $ENTRY | cut -d/ -f5`
  14.       echo sudo apt-add-repository ppa:$USER/$PPA
  15.     done
  16.   done
  17. }
  18.  
  19. list_debs () {
  20.   comm -23 <(apt-mark showmanual | sort -u) <(gzip -dc /var/log/installer/initial-status.gz | sed -n 's/^Package: //p' | sort -u)
  21. }
  22.  
  23. list_ppas *> ./ppas
  24. list_debs *> ./debs
  25. if command -v snap; then snap list *> ./snaps; fi
  26. if command -v luarocks; then luarocks list *> ./rocks; fi
  27. if command -v flatpak; then flatpak list --app *> ./flatpaks; fi
  28.  
Add Comment
Please, Sign In to add comment