Unix – How to find path from where current process/executable is running

pathunix

I am running some executables while connected to a local unix server box.

Say, I'm trying to run an executable 'abc'. Now the server might have provided an alias for 'abc'.. How do I get to know of this path? As in, if I invoke 'abc', it might actually run it from, say, /opt/corp/xyz/abc .. How do I get to know from what path I'm invoking the executable?

By the way I'm running on HP-UX 😀

Best Solution

"which abc" to show which abc you would be calling

or "alias" to list aliases

perhaps "echo $0" from inside a script, or retrieving argv[0] some other way.