Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there a way/command to get a listing of all the commands available on my system from the commandline prompt?

share|improve this question
add comment

6 Answers 6

up vote 10 down vote accepted

Usually pressing tab once or twice will display a message such as:

Display all 435 possibilities? (y or n)

Pressing Y will display all commands you can run that are on your default path.

share|improve this answer
    
I get 'Display all 2821 possibilities?' I'm not sure I want to see them all. But if I do, they're paged with more –  pavium Oct 21 '09 at 7:29
    
Does anyone know if there is a way to pipe this output to less instead of more? (mine is 4481 long :P) If you can, you could then search within the list by typing /keyword –  samjetski Oct 21 '09 at 9:11
    
I think you can set the environment variable PAGER to /usr/bin/less (or whatever the full path to less is), and then bash will use less for paging. –  David Z Oct 21 '09 at 9:39
1  
Pressing Y did nothing. Double tab did work, thanks! –  ricbax Oct 21 '09 at 12:07
1  
I figured out that pressing the esc key twice shows that same results as pressing the tab key. –  ricbax Oct 21 '09 at 12:12
add comment

If you want to display all commands available in your $PATH, you may use this command:

ls $(echo $PATH | tr ":" " ")

If you want to display all executable files available on your filesystem, you may use this command (beware, it might take some time):

find / -type f \( -perm -u=x -o -perm -g=x -o -perm -o=x \) 2>/dev/null

The files listed by this command are not necessarily commands, they are just set as executable.

(you might need to run it as root if you want to search, remove the 2> /dev/null part to know where the find command did not search as a normal user)

You may also want to list your aliases, to do so , you can use this command:

alias
share|improve this answer
1  
The first command would be better written like this: ls ${PATH//:/ }|sort -u –  Teddy Oct 21 '09 at 9:20
add comment

In bash, you can use compgen -c to get all command completions generated to stdout (so you can use grep, etc. instead of just paging through the list). You can also add a prefix:

$ compgen -c ls
ls
lsbom
lsbom
lsdiff
lsof
lsvfs
lsvfs

$ compgen -c | grep zcat
bzcat
bzcat
bzcat
gzcat
gzcat
lzcat
zcat
zcat

$ compgen -c | sort -u | grep zcat
bzcat
gzcat
lzcat
zcat
share|improve this answer
add comment

Not that I know of, but you could either ls /usr/bin or ls /usr/sbin or list all the mans ls /usr/share/man/man1

share|improve this answer
add comment

All the products installed in your system can be executed from the command-line.

However, some built-in commands are available that are specific to the shell that you use.

Here are pointers to documentation about some most used shells : bash, Bourne shell (sh), C shell (csh).

For some shells the built-in help command displays helpful information about the built-in commands.

share|improve this answer
add comment

On a slightly different note:

Many linux systems have man installed.

man -k searchword will list all commands (which have manual files) which have searchword in their description, a little more in-depth and comprehensive (man cmdname will then list the manual for cmdname).

share|improve this answer
add comment

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.