How to use the Type command in Linux
The content of this article mainly focuses on how to use the Type command in Linux. The content of the article is clear and clear. It is very suitable for beginners to learn and is worth reading. Interested friends can follow the editor to read together. I hope you can get something through this article!
The type tool is used to display type information for commands. It will show how entering a given command on the command line will be interpreted.
Use the type command
The type command is built into bash, and the type syntax:
Type [- afptP] [name...]
For example, look at the type of type:
[root@localhost ~] # type typetype is a shell builtin
You can also provide multiple parameters:
[root@localhost ~] # type vim sleep headvim is hashed (/ usr/bin/vim) sleep is / usr/bin/sleephead is / usr/bin/head
Type of command
The-t option tells type to print a word describing the type of command, which will be one of the following:
Alias-alias
Builtin-built-in command
File-Fil
Keyword-keyword
Here are some examples:
Alias
[root@localhost ~] # type-t lsalias# in Centos system, the command corresponding to ls alias is ls-- color=auto [root@localhost bin] # type lsls is aliased to `ls-- color=auto'
Builtin
[root@localhost] # type-t printfbuiltin
Printf is a built-in command for shell
File
[root@localhost] # type-t awkfile
Awk is an executable file
Keyword
[root@localhost] # type-t whilekeyword
While, for, if, else. Wait, it's a reserved keyword in Bash.
Displays the location and type of the command
Use the-a command to display the location and type of the command:
[root@localhost ~] # type-a lsprintf awk whilels is aliased to `ls-- color=auto'ls is / usr/bin/lsprintf is a shell builtinprintf is / usr/bin/printfawk is / usr/bin/awkwhile is a shell keyword
This example shows the type and location of the ls,printf,awk,while command after execution.
What is Linux system Linux is a free-to-use and free-spread UNIX-like operating system, is a POSIX-based multi-user, multi-task, multi-threaded and multi-CPU operating system, using Linux can run major Unix tools, applications and network protocols.
Thank you for your reading. I believe you have some understanding of "how to use the Type command in Linux". Go and practice it. If you want to know more about it, you can follow the website! The editor will continue to bring you better articles!