In UNIX/Linux Shells, there are four different types of commands:
1. executables: compiled binaries or scripts 2. shell builtin commands 3. shell functions 4. aliases
If you encounter an unknown command, the first thing is to check its type. Let's examine a few examples for each type:
type <command> # indicates the commands type -------------- type find # find is /usr/bin/find --> executables type cd # cd is a shell builtin type dequote # dequote is a function type ls # ls is aliased to 'ls --color=auto'
Having the information of the command type, you can get help, description and usage of the command and it's options:
<command> --help # help for executables --> find --help help <command> # help for shell builtins --> help cd man <command> # manual page for the specific command
Following commands are useful for information gathering as well.
whatis <command> # display a very brief description of the command which <command> # display an executables location
In the example above, ls is aliased, but what is ls really?
whatis ls help ls # doesn't work --> ls is not a shell builtin command ls --help # works --> ls is an executable / compiled binary which ls # /bin/ls --> ls is an executable / compiled binary
There are thousands of commands to explore:
ls /bin # list a few executables ls /usr/bin # list more executables enable -p # list all available shell builtin commands declare -f # list all defined functions alias # list all defined aliases
Now let's examine the uname command:
type uname # uname is /bin/uname --> executable whatis uname which uname uname --help # see the meanings of the options, e.g. -a man uname # read the manual page for uname
Do the same for the pyang command...
man uname. What ispyang?