Fundamentals 3 min read

Mastering the Linux ‘type’ Command: Identify Command Types and Paths

Learn how the Linux ‘type’ command reveals whether a given name is an alias, keyword, function, builtin, or external file, and discover its useful options—such as -a, -f, -p, -t, and -P—to control search behavior and output paths.

Open Source Linux
Open Source Linux
Open Source Linux
Mastering the Linux ‘type’ Command: Identify Command Types and Paths

type: Display Command Type

Function Description

The type command shows the type of a specified command, indicating whether it is an internal (builtin, function, alias, keyword) or external command.

Syntax

type [-afptP] name [name ...]

Options

-a : Search the PATH and display all executable files matching name; also show aliases, keywords, functions, and builtins if -p is not used.

-f : Exclude shell functions from the search.

-p : Return nothing unless type -t name yields “file”; otherwise, search PATH and return the executable path.

-t : Output a single word describing the type (alias, keyword, function, builtin, file) or empty if not found.

-P : Even if name is an alias, builtin, or function, still search PATH and return the external executable path.

Parameters

name

: One or more command names to be examined.

Command Types

alias : Alias command.

keyword : Shell reserved word.

function : Shell function.

builtin : Built‑in command.

file : External executable file.

unfound : Not found.

Example Usage

// Alias example
# type ls
ls is aliased to `ls --color=auto`

// Keyword example
# type if
if is a shell keyword

// Builtin example
# type cd
cd is a shell builtin
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

linuxShellcommand-lineUnixtype command
Open Source Linux
Written by

Open Source Linux

Focused on sharing Linux/Unix content, covering fundamentals, system development, network programming, automation/operations, cloud computing, and related professional knowledge.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.