Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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 put two commands together

I need the script to login:

ssh root@

Then I need to the script to run (while logged in to root@ via ssh ):

find /var/mobile/Media/Music/ -name "*.mp3" -exec ln -s {} /var/mobile/Media/Music/"All Songs" \;
share|improve this question
up vote 5 down vote accepted

You can include a command to run on the remote machine as the last argument to ssh

ssh root@ 'find /var/mobile/Media/Music/ [...]'
share|improve this answer
Worked perfectly!! – era878 Mar 20 '11 at 20:16

You can try:

sshpass -p YOUR_PASS_HERE ssh root@ find /var/mobile/Media/Music/ -name "*.mp3" -exec ln -s {} /var/mobile/Media/Music/"All Songs" \;

Cheers, André Gondim

share|improve this answer
Providing password on the command line is not very secure. It's much better to use the public key authentication in such cases. – Adam Byrtek Mar 21 '11 at 15:23

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.