Bash Script to List Applications and Commands

This snippet is a simple bash script designed to iterate over all .desktop files in the /usr/share/applications directory. It extracts and displays the application names and their associated commands using awk for parsing. The results are piped to less for easy viewing.
 avatar
unknown
plain_text
9 days ago
265 B
15
Indexable
#!/bin/bash

# lsapps : 
#   Simple script to list application
#   display names and their associated
#   commands.

for A in /usr/share/applications/*.desktop
do
  awk '/^Exec=/ {e=$0}
       /^Name=/ {n=$0}
       END{printf("%s\n%s\n\n",n,e)}' "$A"
done | less

Leave a Comment