How to work with commands
In previous posts we saw some commands. We didn’t say much about them and we just used them, Now it’s time to talk about them. Commands can be one of the next categories:
- An executable program: In this category programs can be compiled binaries written in some language or scripting language i.e C++, Python, Perl, Ruby, C.
- A built in command into the shell: also known as shell builtins. Bash supports commands like this. pwd command for example is one of these.
- Shell function: think them as miniature shell scripts incorporated into the environment.
- An alias: commands built from another commands but defined by us.
We can determine in which category a command belongs with a simple command: type
which
This command works only on executable programs installed on a system. As a return it give us the exact location of the executable.
If you try it on another command you will get an error. Remeber from above that ls is alias.
See more on a command
Bash has a built in help facility. Simple in use just type help and your command.
Note: square brackets indicate optional items. A vertical bar indicates mutually exclusive items. So let’s examine the first line after help command.
cd [-L|[-P[-e]]] [dir]
- -L or -P are optional
- -P has also -e option follwed by dir argument
Most of the commands have — help option. Try out!
man
This command presents us the with the formal piece of documentation of most executable programs. The fortmat of the displayed page contains title, synopsis, descritpion, listing and description of each option.
i.e. man ls
apropos
This command searches the list of man pages for possible matches.
Number denotes the section in the man page.
man -k is same as apropos
whatis
This command displays the name and one-line description of a man page matching a specified keyword.
Other tools provided are info and documentation of a program provided in /usr/share/doc
More on https://netcrowl.wordpress.com/