Linux Type Command

Are you a Linux user who wants to be more familiar with the command line interface? Then the type command is something you need to know about. This command allows you to obtain information about other commands that you may use on your system. Understanding how to use the type command can make you more efficient and productive when working with Linux.

Linux Type Command

In this article, we’ll cover everything you need to know about the Linux type command. We’ll explain what it is and how it works, and provide examples of how to use it. By the end of this article, you’ll be able to use the type command with ease.

How to Use the type Command

The type command is a built-in function present in shells such as Bash, Zsh, and Ksh. While its functionality may vary slightly depending on the shell, we will focus on the Bash implementation of this command.

To use the type command, use the following syntax:


To determine the type of the wc command, you could input the following command as an illustration:

type wc

The resulting output will appear in a similar format:


wc is /usr/bin/wc

The type command allows for the provision of multiple arguments as well:

type sleep head

Information regarding both the sleep and head commands will be included in the output:


sleep is /bin/sleep
head is /usr/bin/head

Command Types

If you use the -t flag with the “type” command, it will display a word that indicates the type of command. The possible types are:

  1. Alias (a shell alias)
  2. Function (a shell function)
  3. Builtin (a shell builtin)
  4. File (a file on disk)
  5. Keyword (a reserved word in the shell)

Here are some examples:

  • Alias
type -t grep

I have set an alias for grep in my system, so that it runs with the grep --color=auto:


  • Function
type -t rvm

rvm is a utility (feature) designed to facilitate the installation, administration, and utilization of numerous Ruby environments:


  • Builtin
type -t echo

The “echo” command is a built-in function in various shells such as Bash, Zsh, and Ksh:


  • File
type -t cut

An executable file is known as a “cut“:


  • Keyword
type -t for

In Bash, the word “for” is a reserved keyword:



Display all locations that contain the command

To display all matches, utilize the -a flag:

type -a pwd

The output will show you that pwd is a shell builtin but it is also available as a standalone /bin/pwd executable:


pwd is a shell builtin
pwd is /bin/pwd

If the -p option is not utilized, the type command will encompass aliases and functions solely when the -a option is employed.

Other type command options

If the command exists as an executable file on the disk, utilizing the -p flag will oblige the type command to exclusively return the path to the command:

The pwd command, being a shell builtin, won’t produce any output when executed, as demonstrated by the following command.

type -p pwd

Similar to -p, the -P option in uppercase instructs the “type” command to scan through the PATH directories in search of an executable file, even if the command is not a regular file.

type -P pwd

pwd is /bin/pwd

If the -f flag is employed, the type command will refrain from searching for shell functions, in line with the behavior of the command built-in.


In conclusion, utilizing the type command on the command line can provide valuable insight into how a specific command will be interpreted. This can aid in understanding the functionality and potential outcomes of the command before executing it.

If you have any further inquiries or feedback regarding this topic, please do not hesitate to leave a comment below. Stay informed and efficient with your command line usage.



Hey there! My name is Alex and I'm a professional content writer. I'm also lucky enough to be part of an amazing trio team! I absolutely love what I do and I'm passionate about creating content that engages, informs, and entertains. Whether it's writing blog posts, website copy, or social media content, I always strive to deliver high-quality work that exceeds expectations.

We will be happy to hear your thoughts

Leave a reply