Ever want to list all the Linux commands (including bash shell aliases and functions) you could run on the server / workstation? Look now further. Try compgen command.
compgen is bash built-in command and it will show all available commands, aliases, and functions for you. The syntax is:
compgen option
compgen command examples
To list all the commands available to you, enter:
compgen -c
Sample outputs:
ls if then else elif fi .... mahjongg sol gtali sl-h gnobots2 gnotravex iagno fortune gnect gnome-sudoku LS glchess gnuchess gnuchessx
You can search or count the commands:
compgen -c | grep find compgen -c | wc -l echo "$USER user can run $(compgen -c | wc -l) commands on $HOSTNAME."
Sample outputs:
vivek user can run 3436 commands on wks01.
To list all the bash shell aliases available to you, enter:
compgen -a
Sample outputs:
.. ... .... ..... .4 .5 bc cd.. chgrp chmod chown cp dnstop egrep ethtool fastping fgrep grep iftop l. ll ln ls mcdflush mcdshow mcdstats mount mv pscpu pscpu10 psmem psmem10 rm tcpdump update updatey vnstat wget which
See 30 awesome handy bash aliases for more information. Other options are as follows:
######################################## # Task: show all the bash built-ins ######################################## compgen -b ######################################## # Task: show all the bash keywords ######################################## compgen -k ######################################## # Task: show all the bash functions ######################################## compgen -A function
Putting it all together:
compgen -abckA function ## It doesnt get much better than this compgen -abckA function | less compgen -abckA function | grep -i --color searchStringHere
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop





![Top 8 Tools To Search Memory Under Linux / Unix [ Forensics Analysis ]](http://s13.cyberciti.org/images/shared/rp/3/3.jpg)



