Type (Unix)

Last updated
type
Original author(s) AT&T Corporation
Developer(s) Various open-source and commercial developers
Initial release1984;41 years ago (1984)
Operating system Unix and Unix-like
Platform Cross-platform
Type Command

In Unix and Unix-like operating systems, type is a command that describes how its arguments would be interpreted if used as command names.

Contents

Function

Where applicable, type will display the command name's path. [1] [2] Possible command types are:

The command returns a non-zero exit status if command names cannot be found.

Examples

$ typetesttest is a shell builtin$ typecp cp is /bin/cp$ typeunknown unknown not found$ typetypetype is a shell builtin

History

The type command was a shell builtin for Bourne shell that was introduced in AT&T's System V Release 2 (SVR2) in 1984, [3] and continues to be included in many other POSIX-compatible shells such as Bash. However, type is not part of the POSIX standard. With a POSIX shell, similar behavior is retrieved with

command -V name

In the KornShell, the command whence provides similar functionality. [4]

The command is available as a separate package for Microsoft Windows as part of the UnxUtils collection of native Win32 ports of common GNU Unix-like utilities. [5]

See also

References

  1. "Use Type Command in Linux to Get More Info About Commands". Linux Handbook. 2020-05-11. Retrieved 2025-02-09.
  2. "type command in Linux with Examples". GeeksforGeeks. 2019-05-06. Retrieved 2025-02-09.
  3. "traditional Bourne shell family / history and development". www.in-ulm.de. Retrieved 2018-10-07.
  4. Siever, Ellen (27 July 2005). Linux in a Nutshell. Nutshell handbooks. O'Reilly Media, Inc. (published 2005). p. 695. ISBN   9780596009304 . Retrieved 2016-07-05. whence [...] Korn shell only. Show whether each command is a Unix command, a built-in command, a defined shell function, or an alias.
  5. Native Win32 ports of some GNU utilities