Type command to display a command’s type

Share this post to your friends !

This entry is part 2 of 9 in the series Linux commands: Part 5 - Working with commands

WriteBash - 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.

type-command-to-display-a-commands-type Type command to display a command's type
Use “type” command to display command’s type.
linuxmint ~ # type type
type is a shell builtin
linuxmint ~ # type cp
cp is /bin/cp
linuxmint ~ # 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.

Continue reading the series«« Previous part: The command types are in the Linux systemNext part: Display an executable’s location with which command »»
If you liked this article, then please subscribe to our YouTube Channel for more video tutorials. You can also find us on Twitter and Facebook.


Share this post to your friends !
If you appreciate what we share in this blog, you can support us by:
  1. Stay connected to: Facebook | Twitter | Google Plus | YouTube
  2. Subscribe email to recieve new posts from us: Sign up now.
  3. Start your own blog with SSD VPS - Free Let's Encrypt SSL ($2.5/month).
  4. Become a Supporter - Make a contribution via PayPal.
  5. Support us by purchasing Ribbon Lite Child theme being using on this website.

We are thankful for your support.

single post bottom banner
«« »»

Got something to say? Join the discussion

Please keep in mind that all comments are subject to our Comment Policy. Your email address will not be published.
This site uses Akismet to reduce spam. Learn how your comment data is processed.