whence

Official Description

Indicates how a command would be interpreted.

Syntax

whence [-pv] name ...

Options

-a shows all uses of name.

-f excludes functions.

-p searches the path for a name.

-v causes more verbose output.

Oddities

The -a and -f options are available in ksh93 and beyond.

Example

$ whence ls
/bin/ls
$
$ whence -v ls
ls is a tracked alias for /bin/ls
$
$ whence -a echo             # Displays all uses of echo
echo is a shell builtin
echo is a tracked alias for /bin/echo
$
				

Get Korn Shell Programming by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.