Find out if shell command is aliased or not

Q. Sometime I get confuges whether command is an alias or it is real command. How do I find out if shell command is aliased?

A: You need to use type command. It rells whether command is an alias, function, buitin command or executable command file.

For example:

$ type –all ls


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


$ type alias

alias is a shell builtin

So for each command, it indicate how it would be interpreted if used as a command name. You can also try out following options:

  • If the -t option is used, `type’ outputs a single word which is one of alias, keyword, function, builtin, file etc
  • If the -p flag is used, `type’ either returns the name of the disk file that would be executed, or nothing if `type -t NAME’ would not return `file’.
  • If the -a flag is used, `type’ displays all of the places that contain an executable named `file’. This includes aliases, builtins, and functions, if and only if the -p flag is not also used.
  • The -f flag suppresses shell function lookup.
  • The -P flag forces a PATH search for each NAME, even if it is an alias, builtin, or function, and returns the name of the disk file that that would be executed.

See also:

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 0 comments... add one

CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
0 comments… add one

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre> for code samples. Problem posting comment? Email me @