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

Case Analysis using type Command

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

Share

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

This article mainly introduces the relevant knowledge of "type command use case analysis". The editor shows you the operation process through the actual case, and the operation method is simple, fast and practical. I hope this "type command use case analysis" article can help you solve the problem.

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.

Let me show you some examples.

Run the type command without any options.

$type lsls is aliased to `ls-- color=auto'

As you can see in the output above, the ls command has been aliased as ls-color-auto. But it's harmless. But just think about ls if it is aliased for some other dangerous command. You don't want that, do you?

You can use the-t option to find out only the type of Linux command. For example:

$type-t lsalias$ type-t mkdirfile$ type-t pwdbuiltin$ type-t ifkeyword$ type-t rvmfunction

This command displays only the type of command, such as an alias. It does not display content that is aliased. If the command cannot be found, you will not see anything in the terminal.

Another useful thing about the type command is that we can easily find the absolute path to a given Linux command. To do this, use the-p option, as shown below.

$type-p cal/usr/bin/cal

This is similar to the which ls command. If the given command is an alias, nothing is printed.

To display all the information about the command, use the-an option.

$type-a lsls is aliased to `ls-- color=auto'ls is / usr/bin/lsls is / bin/ls

As you can see, the-a flag shows the type of given command and its absolute path. For more details, see the man pages.

This is the end of the introduction of $man type on "type command usage example analysis". Thank you for your reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

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