Super User is a question and answer site for computer enthusiasts and power users. 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 want to embed a remote execution command in an SCP command. Is that possible?

It will save having to execute an SCP command first, then executing an SSH command on the transferred fiies.

Is this possible?

share|improve this question

Why do you want to avoid running scp followed by ssh? Is it because connecting is slow? If so you might want to try ssh multiplexing:

With multiplexing you can connect once, then any future ssh or scp commands will reuse the existing connection.

Here are some links that explain ssh multiplexing:

share|improve this answer

You might be better doing it the other way around - i.e. transferring the files as part of the ssh session, then executing the cmds as part of the same ssh.

See here :

I really don't think scp has the capability you're after but you can 'emulate' the same result over ssh.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .