I am working in a linux system that does not have a which command. Is there an alternative way of finding out which executable is being run by a given command in bash? It is a super basic system (think LFS), so it doesn't have strace, dtrace, or much like that, just the kernel, dev tools, core utilities, and several handfuls of extra packages. Some commands are long running, so ps is useful here, but some commands are near instantaneous.
Asked
Active
Viewed 62 times
1
-
@steeldriver, yup, that answers the question, as does Stephen Harris's answer below. – decuser May 11 '19 at 15:38
1 Answers
3
bash
has a type
command which can help, and is similar to which
.
It can report on commands, aliases and functions
e.g.
bash-4.2$ type ls
ls is /usr/bin/ls
bash-4.2$ alias mycmd=foobar
bash-4.2$ type mycmd
mycmd is aliased to `foobar'
bash-4.2$ myfn()
> {
> echo foo
> }
bash-4.2$ type myfn
myfn is a function
myfn ()
{
echo foo
}

Stephen Harris
- 44,540