type (Unix)

{{lowercase|type (Unix)}}

{{distinguish|TYPE (DOS command)}}

{{Infobox software

| name = type

| logo =

| screenshot = Type command example.png

| screenshot size =

| caption = Examples of type command

| author = AT&T Corporation

| developer = Various open-source and commercial developers

| released = {{Start date and age|1984}}

| latest release version =

| latest release date =

| operating system = Unix and Unix-like

| platform = Cross-platform

| genre = Command

| license =

| website =

}}

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

Function

{{uncited section|date=March 2024}}

Where applicable, type will display the command name's path.{{Cite web |date=2020-05-11 |title=Use Type Command in Linux to Get More Info About Commands |url=https://linuxhandbook.com/type-command/ |access-date=2025-02-09 |website=Linux Handbook |language=en}}{{Cite web |date=2019-05-06 |title=type command in Linux with Examples |url=https://www.geeksforgeeks.org/type-command-in-linux-with-examples/ |access-date=2025-02-09 |website=GeeksforGeeks |language=en-US}} Possible command types are:

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

=Examples=

$ type test

test is a shell builtin

$ type cp

cp is /bin/cp

$ type unknown

unknown not found

$ type type

type 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,{{Cite web|url=https://www.in-ulm.de/~mascheck/bourne/index.html|title=traditional Bourne shell family / history and development|website=www.in-ulm.de|access-date=2018-10-07}} 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.

{{cite book|url=https://books.google.com/books?id=WQPQEbGx73EC|title=Linux in a Nutshell|last1=Siever|first1=Ellen|publisher=O'Reilly Media, Inc.|isbn=9780596009304|series=Nutshell handbooks|date=27 July 2005 |publication-date=2005|page=695|quote=whence [...] Korn shell only. Show whether each command is a Unix command, a built-in command, a defined shell function, or an alias.|access-date=2016-07-05}}

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.[http://unxutils.sourceforge.net/ Native Win32 ports of some GNU utilities]

See also

{{Wikibooks|Guide to Unix|Commands}}

References