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

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

2 Answers 2

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.