If you want to run both in background, put them in a subshell:
(find /tmp/ -type f -mtime +3 | xargs rm -Rf) &
But, please, don't do this. Piping find
output into xargs
is unsafe unless you use the following options, which are supported in GNU and BSD find
and xargs
:
find … -print0 | xargs -0 …
If find
returned files with spaces in their name you could – without even knowing – irreversibly delete the wrong folders. Carefully read the find
manual and the section about deleting files for more info.
The safest way, in your case, would be:
find /tmp/ -type f -mtime +3 -delete &