2. Some commands about commands
-
The command
typedisplays a command's type:type typetype lstype cpThe command
cpis an executable program located on/usr/bin/cp. -
The command
whichdisplays the location of an executable:which lswhich cdThe command
cdis not an executable but a shell builtin command.type cd -
The command
helpdisplays a help page for the shell builtin commands:help cdhelp mkdirThe command
mkdiris not a shell builtin. -
The option
--helpdisplays usage information:mkdir --help -
The command
mandisplays the manual page of a program:man lsManual pages are organized into different sections, where section 1 for example is about user commands, and section 5 is about file formats. So, these two commands will display different manual pages:
man passwdman 5 passwd -
The command
infois another way to display manual pages:info coreutilsinfo passwd -
The command
aproposdisplays appropriate commands:apropos passwdThis is the same as:
man -k passwdIt makes a simple search on man pages for the term "passwd".
-
The command
whatisdisplays a very brief description of a command:whatis ls -
The command
aliasis used to create new commands.alias --helpaliastype aliastype lscd /usr; ls; cd -type fooalias foo="cd /usr; ls; cd -"type foofoounalias footype foo