which and type command

You can also use the which command to display the full path of (shell) commands:

which commandname
which bash

Sample outputs:

/bin/bash

For each of its command line arguments it prints to stdout (screen) the full path of the executables that would have been executed when this argument had been entered at the shell prompt:

which date
which gcc
which vi

However, which cannot tell you exactly what the shell will execute in all cases as it is an external command. For more accurate information, use type command as follows:

type -p commandName
type -p bash
type -p date
type -p gcc
type -p echo

No comments:

Post a Comment

Thank You for your Comments, We will read and response you soon...