Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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 192.168.1.5 "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

1 Answer 1

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

 
discard

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.