Linux type command (describes something)
The type command in Linux is used to describe a name entered as a parameter, such as an internal bash command, program, function, nickname, or file. If no name is provided, it doesn’t do anything.
The type command is generally used to find out information about a Linux command. You can easily find out if the command provided is an alias, embedded shell, file, function, or keyword using the “type” command. In addition, you can also find the actual path of the command.
Why would someone need to find the command “type”? For example, if you happen to work on a frequently shared computer, someone may intentionally or accidentally create an alias for a particular Linux command to perform an unwanted operation, for example “alias ls = rm -rf/”. So it’s always a good idea to inspect them before anything worse happens. This is where the type command comes in handy.
Examples:
Function The other useful advantage of the type command is that we can easily discover the absolute path of a given Linux command. To do this, use the “-p” option as shown below:
This example is similar to the ‘which ls’ command. If the given command is aliased, nothing will be printed.
To view all information about a command, use the “-a” option:
Conclusion
If you need to know about a particular command, you can use the type to describe whether the command is internal to the shell, a program, or an alias.
Learn much more about Linux in our online course. You can register here. If you already have an account, or want to create one, just log in or create your user here.
Did you like it?
Share