Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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)

share|improve this question
2  
Your question isn't clear: are you typing the application name in a shell in a terminal, or in Fluxbox? –  Gilles Nov 13 '11 at 0:27
1  
Press Tab twice in your terminal. –  rozcietrzewiacz Nov 13 '11 at 2:38

3 Answers 3

up vote 6 down vote accepted

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.

share|improve this answer

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; …

share|improve this answer
    
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

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
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.