Skip to content

Instantly share code, notes, and snippets.

@jamiew
Last active September 17, 2023 17:31
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 jamiew/f92d5cd656230d0bd24fa64442400e42 to your computer and use it in GitHub Desktop.
Save jamiew/f92d5cd656230d0bd24fa64442400e42 to your computer and use it in GitHub Desktop.
#!/bin/bash
app="$1"
if [ -z "$app" ]; then
echo "$0: specify binary/app name as first and only argument"
exit 1
fi
echo
echo "which: $(which "$app")"
echo "command -v: $(command -v "$app")"
echo "type: $(type "$app")"
readlink=$(readlink $(command -v "$app"))
[ -z "$readlink" ] && echo "readlink: not a symlink" || echo "readlink: it's a symlink to $readlink"
# other ideas:
# strings /path/to/binary | grep -i "some clue"
# lsattr /path/to/binary -- linux only
echo
echo check package managers...
echo "npm?: "
npm list -g --parseable --depth 0 | grep "$app"
echo "pnpm?: "
pnpm list -g --parseable --depth 0 | grep "$app"
echo "yarn?: "
yarn global list | grep "$app"
echo "cargo?: "
cargo install --list | grep "$app"
echo "pip?: "
pip list | grep "$app"
echo "homebrew?: "
brew list | grep "$app"
# apt?
# snap?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment