How to find and verify Unix/Linux/OS X shell full path using command line

Fig.02: Finding out your shell path

Fig.02: Finding out your shell path

The commands are as follows to find full path to your current or any shell installed on Linux or Unix-like systems including Apple OS X, Ubuntu, CentOS, FreeBSD, Openbsd and more:

type {shell-name-here}
type -a {shell-name-here}
type -a bash
type -a ksh
type -a zsh
type -a sh
type -a fish

The -a is passed to the type command to show you all of the places that contain an executable named ksh, bash, sh and more. See your shell man page or type the following command for more:

help type

Sample outputs:

type: type [-afptP] name [name ...]
    For each NAME, indicate how it would be interpreted if used as a
    command name.
 
    If the -t option is used, `type' outputs a single word which is one of
    `alias', `keyword', `function', `builtin', `file' or `', if NAME is an
    alias, shell reserved word, shell function, shell builtin, disk file,
    or unfound, respectively.
 
    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 would
    be executed.
typeset: typeset [-afFirtx] [-p] name[=value] ...
    Obsolete.  See `declare'.

Examples and usage: A Shell Primer: Master Your Linux, OS X, Unix Shell Environment

Leave a Comment