What is the usage of the “type” command in Linux?

In Linux, the “type” command is used to determine the type of a specific command. It can inform you whether a particular command is a built-in command, an external command, or an alias.

The syntax to be used is as follows:

type [options] [command]

Common options include:

  1. Print only the type of command, without print specific details.
  2. -a: Print all commands related to the specified command.

For example, to find the type of the ls command, you can run the following command:

type ls

The output result could be:

ls is aliased to `ls --color=auto'

or

ls is /bin/ls

This indicates that the “ls” command is an alias or an external command.

To search for all commands related to a specific command, you can use the -a option.

type -a ls

The possible output could be:

ls is aliased to `ls --color=auto'
ls is /usr/bin/ls

This indicates that the “ls” command is both an alias and an external command.

bannerAds