Type command to display a command’s type

by Daniel Pham
Published: Updated:
This entry is part 2 of 9 in the series Linux commands: Part 5 - Working with commands

In this article, we will learn about the type command, the type command used to display a command’s type.

The type command itself is a builtin shell, which can be executed regardless of the other program.

Type command syntax

The syntax of the type command is quite simple, the syntax will look like this:

$ type command

Here, we’ll try some examples.

use type command to display command's type
Use “type” command to display command’s type.
~ $ type type
type is a shell builtin
~ $ type cp
cp is /bin/cp
~ $ type ls
ls is aliased to `ls --color=auto'

The result of the type of commands seems different. According to the previous article, we have about 4 types of commands.

Now that you can see, the type command returns type is a shell builtin, which is the builtin type.

The cp command returns the result cp is /bin/cp, which is the type of executable program.

As for ls, the result is ls is aliased to `ls --color=auto', you might wonder why it is alias. Do you notice that when you type the ls command, the files and folders have different colors, thanks to the --color option.

The ls command on different operating systems may have different aliases. For example, in Linux Mint, alias is ls --color=auto. The ls command in Fedora, alias is ls --color=tty.

Conclustion

The type command may be useful in some cases. For example, you need to know that command is using which executable file or which file to link to.

(This is an article from my old blog that has been inactive for a long time, I don’t want to throw it away so I will keep it and hope it helps someone).

0 0 votes
Article Rating
Series Navigation«« Previous part: The command types are in the Linux systemNext part: Display an executable’s location with which command »»

You may also like

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments

DevOps Lite is a personal blog specializing in technology with main topics about DevOps, DevSecOps, SRE and System Administrator. Articles are shared for free and contributed to the community.

SUPPORT US

FOLLOW US

Subscribe my Newsletter for new blog posts. Stay updated from your inbox!

© 2021-2024 DevOpsLite.com – All rights reserved.

Please write sources “DevOpsLite.com” when using articles from this website.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

2
0
Would love your thoughts, please comment.x
()
x

Adblock Detected

Please support us by disabling your AdBlocker extension from your browsers for our website.