____________________
(BUTTON) Menu
* 🏠 Home
* 🐧 Topic
+ All in One
+ DevOps
o Ansible
o AWS
o Docker
o Git
o Jenkins
o Kubernetes
+ Hardware
o Raspberry Pi
+ How to
+ Linux Commands
o Builtin Commands
o Curl Commands
o Homebrew Commands
o MySQL Commands
o SSH Commands
+ Linux Distributions
o Alma Linux
o Debian
o Fedora
o Kali Linux
o Linux Mint
o Manjaro
o Red Hat
o Ubuntu
+ News & Updates
+ Package Installer
+ Programming
o Bash Scripting
o C/C++
o Go Lang
o Java
o Javascript
o Node Js
o Php
o Python
o Ruby
+ Reviews
+ Tools
+ Troubleshooting
+ Tutorials
+ Weekly Roundup
+ What is
* 🕵️ Privacy Policy
* 📧 Contact Us
* 📖 About
+ 🪶 Write an Article
+ 🔗 Follow Us
+ 🎁 Donate
Beginners Guide for Type Command in Linux
Linux TLDR
Last Updated: December 15, 2025
No Comments
Reading time: 3 minutes
The type command tells you the actual type of the referenced command.
With this information, you can figure out how a command will be
interpreted when you execute it in the terminal.
The following is the list of known command types:
* Alias
* Shell built-in
* File
* Function
* Keyword
Aside from showing the file type, this command can also be used to find
and show all the locations that contain the referenced command (in
binary).
Knowing all the things it offers might discourage your desire to go
forward, but trust me, this command will come in handy, especially when
you’re trying to figure out why a command is acting in a certain way.
So, read this article to find out everything you need to know about
this command, including its different options (with practical
examples).
Table of Contents
Toggle
* Tutorial Details
* Syntax of the Type Command
* Identifying the Actual Type of the Referenced Command
* Trim the Type Command Output
* Force Type to Return the Path of the Referenced Command
* Getting More Information About the Referenced Command
* What Does “Command is Hashed” Mean in the Output?
* Conclusion
Tutorial Details
Description Type
Difficulty Level Low
Root or Sudo Privileges No
OS Compatibility Ubuntu, Manjaro, Fedora, etc.
Prerequisites type
Internet Required No
Syntax of the Type Command
The type command takes two arguments: one is the option, and the other
is the command or file name.
$ type [OPTION] [COMMAND or FILE NAME]
Identifying the Actual Type of the Referenced Command
To make things easier for beginners, let’s pass the most commonly used
echo command as an argument to the type command without any options.
$ type echo
Output:
Checking the type of echo command
As you can clearly see, the echo command is a shell built-in command
and is interpreted in this way whenever it is executed.
Note that you are not limited to passing a single command; you can pass
multiple commands to the type command at the same time to find their
actual types.
$ type ls cp if
Output:
Checking the type of multiple commands
In the above picture, it states that “ls” is an alias for the “ls
--color=auto” command. Check out our article on the ls command and
creating shortcuts in Linux to know why.
The cp command is referring to the “/usr/bin/cp” binary, and “if” is a
shell keyword (mostly used in shell scripting).
Trim the Type Command Output
Instead of getting the extra information in the output, you can trim
the results into just the type of the command using the “-t” flag.
The following is the list of known command types:
* Alias
* Builtin
* File
* Function
* Keyword
The following is an example of when a single command is passed to a
type command with the “-t” flag.
$ type -t echo
Output:
Short description of the echo command
The following is an example when multiple commands are passed to type
command with “-t” flag.
$ type -t ls cp if
Output:
Short description for multiple commands
Force Type to Return the Path of the Referenced Command
If you are only interested in finding the executable path of the
referenced command without worrying whether its built-in shells or
aliases, then you can use the “-P” flag.
$ type -P echo
Output:
Only return the executable path of the referenced command
When you pass the mixtures of multiple commands to find their
executable path you will get the following results.
$ type -P ls cp if
Output:
Returning executable path for multiple commands
As you can clearly see from the above picture, the executable paths for
the ls and cp commands return in output, except for “if“, which is a
shell keyword and not an executable file.
Getting More Information About the Referenced Command
The “-a” flag is useful when you want to know the type of the command
and all the places where the referenced command (executable file) can
be found.
In the following example, the echo command is being passed with the
“-a” flag.
$ type -a ls
Output:
Getting more information about the ls command
You will get a combination of mixed results when you pass the multiple
commands with the “-a” flag.
$ type -a ls cp if
Output:
Getting more information about multiple commands
What Does “Command is Hashed” Mean in the Output?
Sometimes, when you check the type of the referenced command, you might
end up getting “command is hashed” along with the path in the output.
$ type man
Output:
Command is hashed
The reason for this output, even though it may only occasionally occur,
is that your shell keeps a record of every executable program that it
has ever discovered in a list known as the hash list.
This way, the shell avoids wasting time searching for the path of an
executable by returning the results from previous searches, even though
you can use the “hash -r” command to force the shell to start searching
from scratch.
Conclusion
If you read the complete article, then you realize how useful and handy
this tool can be when you want to determine the command type or how
it’s acting in a certain way.
If you have questions or queries related to this topic, then feel free
to ask them in the comment section.
Till then, peace!
SHARE:
Recommended Articles
🔗How to Install Zabbix Server on Ubuntu 24.04 (Noble Numbat)
🔗Stellar Repair for MySQL – Product Review
🔗How to Install RQuickShare (NearbyShare/QuickShare) on Linux
🔗How to Install RabbitMQ Server on Linux (Quick Guide)
🔗How to Use Chattr Command in Linux (for Beginners)
🔗How to Setup SOCKS5 Proxy Server on Linux Using MicroSocks
🔗Reset the WordPress Admin Password Using CLI (via 2 Methods)
🔗How to Check Python Version in Linux (via 3 Methods)
🔗How to Check PHP Version in Linux (via 4 Methods)
🔗[Fixed] pkg-config script could not be found in Linux
Join The Conversation
Users are always welcome to leave comments about the articles, whether
they are questions, comments, constructive criticism, old information,
or notices of typos. Please keep in mind that all comments are
moderated according to our comment policy.