Skip to content

Instantly share code, notes, and snippets.

@adinan-cenci
Created October 20, 2022 11:45
Show Gist options
  • Save adinan-cenci/e420e2a457aad89f9776702e9968c84c to your computer and use it in GitHub Desktop.
Save adinan-cenci/e420e2a457aad89f9776702e9968c84c to your computer and use it in GitHub Desktop.
List all .desktop files on the system
#!/bin/bash
# At the moment this will list all the .desktop files on the system
# even the ones not currently installed
# Setting IFS (input field separator) value as ":"
IFS=':'
# Reading the split string into array
read -ra arr <<< "$XDG_DATA_DIRS"
# Search for .desktop files
for val in "${arr[@]}";
do
if [ -d $val ] ; then
find $val -name "*.desktop" -type f
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment