4

I'm using fluxbox and recently i wanted to start an application for video editing and i couldn't remember it's name. I usually run apps from terminal so I was wondering is there a way to list all (applications or) app specific commands like Xmonad's "run or raise" feature? This feature can be seen here at 1:14 : http://www.youtube.com/watch?v=AyNkBLhIpQk&feature=related

Edit : I want to te able to type a command in terminal that will return the list of all applications installed (the list of all application commands available e.g. shotwell, gedit, gvim, vim, vi, firefox, chromium-browser etc.) basically i want to know which apps I can run (which apps i have)

akira
  • 1,054

3 Answers3

6

If you're using bash(1), you can use the compgen builtin:

$ compgen -abc -A function

-a for aliases, -b for builtins, -c for commands and -A function for shell functions. You can choose which if these you want to exclude, as you'll get a rather large list (on my system I get 3206 commands).

The compgen command is meant for generating command line completion candidates, but can be used for this purpose too.

camh
  • 39,069
1

This is trivial if we assume that "apps you can run" is synonymous with "executables in your path":

#!/bin/bash
IFS=: read -ra _dirs_in_path <<< "$PATH"

for _dir in "${_dirs_in_path[@]}"; do
    for _file in "${_dir}"/*; do
        [[ -x ${_file} && -f ${_file} ]] && printf '%s\n' "${_file##*/}"
    done
done
Chris Down
  • 125,559
  • 25
  • 270
  • 266
1

If you type at least one letter, then press Tab, you'll see a list of all the executable programs whose name begins with that letter. This is called completion or autocomplete.

You can list all the executable programs with this shell snippet:

( IFS=':'; set -f;
  for dir in $PATH; do
    for x in $dir/*; do echo $x; done
  done )

This lists all the executable programs you have, which may be more general than what you intend by “all applications”. You'll also see a number of commands which are intended to be called by other commands, and are rarely invoked directly by users. A list of the applications that are intended to be invoked from a GUI is available through the *.desktop files under /usr/share/applications. The following command will display them (you'll find crumbs like %u, %c and so on, indicating what kinds of arguments the command typically expects; they are described in the desktop file format specification).

grep -Proh '(?<=^Exec=).*' /usr/share/applications

You may get a better feel for what applications you have installed by listing the packages you have: dpkg -l under Debian, Ubuntu and derivatives; rpm -ql under Red Hat, Fedora, SuSE and derivaties; …

  • Thank you for your effort, but i solved it with the previous answer, whatsoever i don't question your solution but i don't have time to try it. Thanks once again. – vanjadjurdjevic Nov 13 '11 at 19:28