Learn how the shell resolves a word so you can spot aliases, functions, builtins and executables. 19.05.2026 | reading time: 3 min What does the shell mean when it runs "ls"? The `type` command tells the truth: whether a name is an alias, a shell function, a builtin, a keyword, or an external program; read on and try it yourself. Try this on the command line Run a few quick checks to see how `type` reports different names: ``` $ type ls ls is aliased to "ls --color=auto" $ type -a ls ls is aliased to "ls --color=auto" ls is /bin/ls $ type -t cd builtin $ hello(){ echo hi; } $ type hello hello is a function hello () { echo hi; } $ type -P ls /bin/ls ``` Use cases that matter Use `type` to troubleshoot why a command behaves differently than expected, to detect whether a utility is a builtin or an external program, and to write robust scripts; combine `type -t` in conditionals to branch on alias/function/builtin/file, use `type -a` to list every match the shell would consider, and use `type -P` when you need the absolute path to the executable ignoring functions and builtins. Shell portability and gotchas Remember that `type` is a shell builtin in bash, zsh, and other shells and that behavior and option names can vary slightly across shells; for script portability prefer `command -v` in POSIX contexts and test on the target shell, because an interactive prompt may hide aliases or environment differences. Where `type` fits in your toolbox When hunting down unexpected behavior start with `type` to reveal aliases and functions, then fall back to tools that search the filesystem or provide different views of a command; practice these steps and he will understand how the shell picks which program to run. Keep exploring Knowing how the shell resolves names removes a lot of friction when debugging and scripting; keep practicing with real examples and consider formalizing that skill with certification training like CompTIA Linux+ or LPIC-1, and intensive exam prep at bitsandbytes.academy. Join Bits & Bytes Academy First class LINUX exam preparation. utilities scripting troubleshooting