Difference between revisions of "Type command"

From Linux Shell Scripting Tutorial - A Beginner's handbook
Jump to navigation Jump to search
Line 20: Line 20:
 
| file
 
| file
 
| date command is a disk file which can be verifyed by typing which date command<br /><code>which date</code>
 
| date command is a disk file which can be verifyed by typing which date command<br /><code>which date</code>
 +
|-
 +
| type -t xrpm
 +
| function
 +
| xrpm is a user defined function.
 +
|-
 +
| type -t if
 +
| keyword
 +
| if is a shell reserved word,  which is used for flow control.
 
|}
 
|}

Revision as of 11:51, 12 September 2009

The type command is used to find out if command is builtin or external binary file. It also indicate how it would be interpreted if used as a command name.

Find Out Command Type

If the -t option is used, it will print a single word which is one of the following

  • alias (command is shell alias)
  • keyword (command is shell reserved word)
  • function (command is shell function)
  • builtin (command is shell builtin)
  • file (command is disk file)

Try the following examples:

Command Output Meaning
type -t ls alias ls command is alias which can be verified by typing alias command itself
alias
type -t date file date command is a disk file which can be verifyed by typing which date command
which date
type -t xrpm function xrpm is a user defined function.
type -t if keyword if is a shell reserved word, which is used for flow control.