Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use type command in linux system

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "how to use type commands in the linux system", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to use type commands in the linux system" this article.

The type command is used to display the type of specified command and to determine whether the instruction given is an internal instruction or an external instruction.

How to 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:

Type of [root@localhost ~] # type vim sleep headvim is hashed (/ usr/bin/vim) sleep is / usr/bin/sleephead is / usr/bin/head 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-file keyword-keyword

Here are some examples:

Alias [root@localhost ~] # type-t lsalias# in the Centos system, the command corresponding to the 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.

The above is all the contents of the article "how to use type commands in linux system". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report