Skip to content

Instantly share code, notes, and snippets.

@chiranthsiddappa
Last active August 1, 2019 22:15
Show Gist options
  • Save chiranthsiddappa/00c2fffe1ce28d918800b468de8ee748 to your computer and use it in GitHub Desktop.
Save chiranthsiddappa/00c2fffe1ce28d918800b468de8ee748 to your computer and use it in GitHub Desktop.
List development packages being used on Ubuntu
#!/bin/bash
source ~/.bash_profile
if hash sdk 2>/dev/null; then
sdk current
echo "Gradle cache:"
pushd ~/.gradle/caches && tree | grep '.jar' | grep -v 'sources' | rev | cut -d' ' -f1 | rev | sed 's/[-_][0-9].*//' | sort| uniq
popd
fi
if hash python2 2>/dev/null; then
echo "Python2 Pip: "
python2 -m pip list | cut -d' ' -f1
echo "Python2 builtins:"
python2 -c "help('modules')"
fi
if hash python3 2>/dev/null; then
echo "Python3 Pip: "
python3 -m pip list | cut -d' ' -f1
echo "Python3 builtins:"
python3 -c "help('modules')"
fi
if hash dpkg 2>/dev/null; then
echo "DPKG: "
dpkg -l
fi
if hash find 2>/dev/null; then
pushd ~
echo "Finding python requirement files"
find . -name 'requirements.txt' -exec cat {} \; |sort |uniq
echo "Done with python requirements files"
echo "Finding compile libraries from gradle"
find . -name 'build.gradle' -exec cat {} \; | grep 'compile ' |sort |uniq
echo "Finding ruby file requirements"
find -name '*.rb' -exec cat {} \; |grep 'require' |sort |uniq
echo "Any brewfiles: "
find -name 'Brewfile' -exec cat{} \; | cut -d' ' -f2 | tr -d '"' | tr -d ',' | sort | uniq
popd
fi
if hash yum 2>/dev/null; then
echo "YUM packages:"
yum list installed
fi
if hash docker 2>/dev/null; then
echo "Docker images:"
docker images
fi
if hash gem 2>/dev/null; then
echo "Rubygems: "
gem list
fi
if hash rvm 2>/dev/null; then
echo "RVM: "
rvm list
fi
if hash npm 2>/dev/null; then
echo "NPM: "
npm list -g | grep '@' Npmfile | rev | cut -d' ' -f1 | cut -d'@' -f2 |rev | sed 's/[[:space:]]*$//' |sort| uniq
fi
if hash go 2>/dev/null; then
echo "Go: "
pushd $GOPATH
go list ...
popd
fi
if hash port 2>/dev/null; then
echo "Port: "
port installed
fi
if hash brew 2>/dev/null; then
echo "Brew: "
brew bundle dump --all
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment