Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to use plink (or something similar if you have something on mind) to get the output from Debian remote machine onto my Windows box. This works e.g. in this case :

plink "ls" > log.txt

But when I want to use different command like e.g. ifconfig or what is my point of interest my alias for the script I get the error command not found :

Server sent command exit status 127
bash: showip: command not found
Disconnected: All channels closed

Where does the plink look for commands in this case ? I can easily execute aforementioned commands.

share|improve this question
up vote 3 down vote accepted

plink is running non-interactively and therefore doesn't get your normal shell setup; in particular $PATH is going to be the default (typically /bin:/usr/bin:/usr/local/bin or some permutation thereof). In particular it will have neither your personal bin directory (wherever you put it) or /usr/sbin where many tools like ifconfig live.

share|improve this answer
You can always use getconf to show the details. For example, ssh localhost '/usr/bin/getconf PATH' returns /bin:/usr/bin on my system. – CodeGnome May 28 '12 at 6:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.