Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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 need to use a find command in a script with ssh and grep together. Something like this:

ssh user@host find /var/log -type f -mtime 1 -exec grep -i -F error warn {} \;

But it says, that there is no argument for -exec.

What should I do to fix this?

share|improve this question
up vote 0 down vote accepted

Put the commands inside quotes:

ssh user@host "find /var/log -type f -mtime 1 -exec grep -i -F error warn {} \;"


ssh user@host 'find /var/log -type f -mtime 1 -exec grep -i -F error warn {} \;'
share|improve this answer
Thanks! This worked like a charm! – Airee Apr 11 '13 at 2:53

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.