Limok Palantaemon Limok Palantaemon - 6 months ago 34
Linux Question

Linux: Can't find expect in my /bin/ or /usr/bin after installing. How do I find it?

I realise this might be a stupid question, but I've been trying to follow the advice on the following post

However, I've come up to a problem. I installed expect with

sudo apt-get install expect
but now embarrassingly I can't figure out where the script interpreter is. It doesn't seem to be in the normal paths where people look to (i.e

It does seem to have installed, since
$ expect
seems to work, but I just can't use the interpreter (i.e I try to shebang it like everyone else with
and it gives an error).


You can find the location by listing all the files the package expect provides by dpkg -L:

dpkg -L expect

or narrow it down to only the filenames ending in expect:

dpkg -L expect | grep '/expect$'

or if resides in typical binary directories:

dpkg -L expect | grep -E '/s?bin/'

Also the typical way to go through the $PATH for an executable is to use:

which expect

or better (considering shell internals), not strictly needed in this case though:

type -a expect