{{Short description|Unix command}} {{Lowercase title}} {{distinguish|TYPE (DOS command)}} {{Infobox software | name = type | logo = | screenshot = Type command example.png | screenshot size = | caption = Examples of <code>type</code> 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, '''<code>type</code>''' is a command that describes how its arguments would be interpreted if used as command names.
==Function== Where applicable, <code>type</code> will display the command name's path.<ref>{{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}}</ref><ref>{{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 |archive-date=2025-03-04 |archive-url=https://web.archive.org/web/20250304091600/https://www.geeksforgeeks.org/type-command-in-linux-with-examples/ |url-status=live }}</ref> Possible command types are: * shell built-in * function * alias * hashed command * keyword
The command returns a non-zero exit status if command names cannot be found.
===Examples=== <syntaxhighlight lang="console"> $ 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 </syntaxhighlight>
==History== The <code>type</code> command was a shell builtin for Bourne shell that was introduced in AT&T's System V Release 2 (SVR2) in 1984,<ref>{{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|archive-date=2004-02-03|archive-url=https://web.archive.org/web/20040203204407/https://www.in-ulm.de/~mascheck/bourne/index.html|url-status=live}}</ref> and continues to be included in many other POSIX-compatible shells such as Bash. However, <code>type</code> is not part of the POSIX standard. With a POSIX shell, similar behavior is retrieved with command -V name
In the KornShell, the command <code>whence</code> provides similar functionality.<ref> {{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}} </ref>
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.<ref>{{Cite web |url=https://unxutils.sourceforge.net/ |title=Native Win32 ports of some GNU utilities |access-date=2026-02-03 |archive-date=2006-02-09 |archive-url=https://web.archive.org/web/20060209022842/http://unxutils.sourceforge.net/ |url-status=live }}</ref>
==See also== {{Wikibooks|Guide to Unix|Commands}} * List of Unix commands * which (command) * hash (Unix)
==References== {{Reflist}}
{{Unix commands}}
Category:Standard Unix programs Category:Unix SUS2008 utilities Category:IBM i Qshell commands
{{operating-system-stub}}