A Linux dedicated server is all about commands. At some point, you will inevitably need to manage it from SSH (Secure Shell), which means you will be presented with a command line interface. While you may already know some commands, it is nice to see what the server offers as a whole. You can do that with the compgen command. It gives you a list of commands of a certain type or of all commands in general.
From the shell prompt, simply type:
The output will look something like this:
These will be commands available to you.
To see the total number of commands that you can run, type the following:
compgen -c | wc -l
echo “$USER user can run $(compgen -c | wc -l) commands on $HOSTNAME.”
The output would look like this:
tavis user can run 3400 commands on serverschool
Compgen has some other options as well.
- compgen -a lists all bash aliases available to you
- compgen b shows all bash built-ins
- compgen -k shows all the bash keywords
- compgen -A shows all the bash functions
For more information about compgen, you can read the documentation online.
- How to String Multiple Linux Commands Together
- Learning to Use Linux Commands
- 5 Different Ways to List Files on a Linux Server
- Extend Linux Commands with a Pipe
- How to Schedule Commands in Webmin