Skip to content

Instantly share code, notes, and snippets.

@Bigjango13
Last active March 28, 2022 20:51
Show Gist options
  • Save Bigjango13/b2ca994f557e61ca381277f9227777c8 to your computer and use it in GitHub Desktop.
Save Bigjango13/b2ca994f557e61ca381277f9227777c8 to your computer and use it in GitHub Desktop.
A small function to see what programs can open a file.
canopener (){
if [[ $1 == "" ]]; then
echo "You need to specify a file."
else
grep "`xdg-mime query filetype $1`" -R /usr/share/applications/* --files-with-matches --color=never | grep -v mimeinfo.cache | xargs grep "^Exec=" --no-filename | awk -F'=' '{print $2}' | awk -F' ' '{print $1}' | sort | uniq
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment