Skip to content

Instantly share code, notes, and snippets.

@martinandersen3d
Created April 29, 2021 11:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save martinandersen3d/7901edf0da00d544b3ddf2d0b59fddaf to your computer and use it in GitHub Desktop.
Save martinandersen3d/7901edf0da00d544b3ddf2d0b59fddaf to your computer and use it in GitHub Desktop.
Linux / Ubuntu - List all installed programs and write to a text file
#!/bin/bash
sleep 1
LANG=en_US.UTF-8
outfile="~/installed_programs.txt"
# This Bash command will print all manually installed packages minus the ones that came from your Debian installation (in other words, the packages that you installed with apt install):
echo ' ' >> $outfile
echo 'COMMANDLINE UTILLITIES--------------------------------------------' > $outfile
apt-mark showmanual >> $outfile
echo ' ' >> $outfile
echo '.Desktop List (best) --------------------------------------------' >> $outfile
find /usr/share/applications ~/.local/share/applications -name '*.desktop' >> $outfile
echo ' ' >> $outfile
echo '.Desktop List (all) --------------------------------------------' >> $outfile
dpkg --search '*.desktop' | awk '{print $1}' | sed "s/://" | sort --unique >> $outfile
echo ' ' >> $outfile
echo 'Recent installed --------------------------------------------' >> $outfile
grep " install " /var/log/dpkg.log >> $outfile
echo ' ' >> $outfile
echo 'From history --------------------------------------------' >> $outfile
grep " install " /var/log/apt/history.log >> $outfile
echo ' ' >> $outfile
echo 'FLATPAK--------------------------------------------' >> $outfile
flatpak list >> $outfile
echo ' ' >> $outfile
echo 'SOURCES--------------------------------------------' >> $outfile
cat /etc/apt/sources.list >> $outfile
echo ' ' >> $outfile
echo 'BINARYS--------------------------------------------' >> $outfile
ls /usr/bin >> $outfile
echo ' ' >> $outfile
echo 'NPM--------------------------------------------' >> $outfile
npm list -g --depth 0 >> $outfile
echo ' ' >> $outfile
echo 'PYTHON--------------------------------------------' >> $outfile
pip3 list >> $outfile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment