0

I'm trying to login into multiple servers and execute the following command:

arp -an|grep lanx>lanx

I'm using this method:

ssh [email protected] arp\ -an|grep\ lanx >lanx

but it is not working its giving me an error

2
  • 2
    Please show us the exact error you are getting. It might be though, because you didn't put the "arp" command in quotes und thus the pipe is interpreted locally and not the remote machine. Try ssh [email protected] 'arp -an|grep lanx' > lanx. Commented Aug 2, 2013 at 11:01
  • Yeah this have done the trick, it was cuase the ' ' thanks ! :) Commented Aug 2, 2013 at 11:05

2 Answers 2

1

ideally just put the commands in quotes like this:

ssh [email protected] '/sbin/arp -an | grep lanx' > lanx

or

ssh [email protected] '/sbin/arp -an' | grep lanx > lanx

The other problem might be the user admin on your machine does not have arp in PATH (is he root? arp is usually in /sbin/ and /sbin/ is usually not in PATH of a regular user.

Sign up to request clarification or add additional context in comments.

Comments

0

put in subshell. something like this will make things more clear:

(ssh xxxx arp -an) | grep lanx > /tmp/lanx

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.