Linux Command type display command type

Source: Internet
Author: User
Tags builtin

Type COMMANDDescription

Type COMMANDDisplays the type of the specified command. A command can be of the following type:

Alias alias
Keyword keywords, shell Reserved Words
Function, shell function
Builtin built-in commands and shell built-in commands
File files, disk files, external commands
Unfound not found

It is a kind of introspection mechanism of the Linux system. If we know the type, we can get targeted help. For example, the built-in command can use the help command to get help, and the external command can use man or info to get help.
Common parameter wiiu creative path: Changes in somatosensory controllers and games

The basic usage of the type command is to keep up with the command name directly.

Type-A can display all possible types. For example, some commands such as PWD are shell built-in commands or external commands.

Type-P only returns information about external commands, which is equivalent to the which command.

Type-F only returns information about Shell functions.

Type-t only returns information of the specified type.
Example
Example 1: What type of command is type?

[Root @ new55 ~] # Type-A type
Type is a shell builtin
[Root @ new55 ~] # Help type
Type: Type [-afptp] Name [name...]
For each name, indicate how it wocould be interpreted if used as
Command name.

If the-T option is used, 'type' outputs a single word which is one
'Alias', 'keyword', 'function', 'builtin ', 'file' or '', if name is
Alias, shell reserved word, shell function, shell builtin, disk file,
Or unfound, respectively.

If the-P Flag is used, 'type' either returns the name of the Disk
File that wocould be executed, or nothing if 'Type-T name' wocould not
Return 'file '.

If the-a flag is used, 'type' displays all of the places that contain
An executable named 'file'. This includes des aliases, builtins, and
Functions, if and only if the-P Flag is not also used.

The-F flag suppresses shell function lookup.

The-P Flag forces a path search for each name, even if it is an alias,
Builtin, or function, and returns the name of the disk file that wowould
Be executed.
Typeset: typeset [-affirtx] [-p] Name [= value]...
Obsolete. See 'desc '.
[Root @ new55 ~] #
Example 2 Common commands

[Root @ new55 ~] # Type-A CD
CD is a shell builtin
[Root @ new55 ~] # Type-A pwd
PWD is a shell builtin
PWD is/bin/pwd
[Root @ new55 ~] # Type-a time
Time is a shell keyword
Time is/usr/bin/Time
[Root @ new55 ~] # Type-a date
Date is/bin/date
[Root @ new55 ~] # Type-A which
Which is aliased to 'Alias |/usr/bin/which -- tty-only -- read-alias -- show-dot -- show-tilde'
Which is/usr/bin/which
[Root @ new55 ~] # Type-A whereis
Whereis is/usr/bin/whereis
[Root @ new55 ~] # Type-A whatis
Whatis/usr/bin/whatis
[Root @ new55 ~] # Type-A Function
Function is a shell keyword
[Root @ new55 ~] # Type-A ls
Ls is aliased to 'ls -- color = tty'
Ls is/bin/ls
[Root @ new55 ~] # Type-A LL
Ll is aliased to 'LS-l -- color = tty'
[Root @ new55 ~] # Type-A echo
ECHO is a shell builtin
ECHO is/bin/echo
[Root @ new55 ~] # Type-A bulitin
-Bash: Type: bulitin: not found
[Root @ new55 ~] # Type-a builtin
Builtin is a shell builtin
[Root @ new55 ~] # Type-A keyword
-Bash: Type: Keyword: not found
[Root @ new55 ~] # Type-A command
Command is a shell builtin
[Root @ new55 ~] # Type-A alias
Alias is a shell builtin
[Root @ new55 ~] # Type-A grep
Grep is/bin/grep
[Root @ new55 ~] #

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.