type

Describe a command.

Syntax
       type [-aftpP] name [name ...]

Options
     With no options, indicate how each name would be interpreted if used as a command name.

     -t   Print a string describing the file type

The string printed is one of: alias, keyword, function, builtin, or file if name is an alias, shell reserved word, function, builtin, or disk file, respectively. If the name is not found, then nothing is printed, and an exit status of false is returned.

     -p  Print the path of the disk file that name would execute as a command.
         returns nothing if `type -t name' would not return file.

     -P  Force a PATH search for each name, even if `type -t name' would not return file.

If a command is hashed, -p and -P print the hashed value, not necessarily the file that appears first in PATH.

     -a  Prints all the places that contain an executable named name. 

This includes aliases and functions, if and only if the -p option is not also used.
The table of hashed commands is not consulted when using -a.

    -f  Suppress shell function lookup, as with the command builtin.

type returns true if any of the arguments are found, false if none are found.

type is a bash built in command.

Examples:

 $ type -a grep
 grep is /usr/bin/grep
 
 $ type type
type is a shell builtin $ type lsl lsl is a function lsl () { ls -l $1 }

"Character is not made in a crisis - it is only exhibited" ~ Robert Freeman

Related:

which - Locate a program file in the user's path
ls - List information about file(s)
locate - Find files


© Copyright SS64.com 1999-2014
Some rights reserved