Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

the command

find /tmp -name 'core*' -type f -print0 | xargs -0

works fine on Linux, but xargs -0 option is not legal on Solaris

what is the equivalent option ( xargs? ) for Solaris 10

second question:
is it possible to change the syntax:

find /tmp -name 'core*' -type f -print0 | xargs -0

So it will fit for both OS - Linux and Solaris

I try on my solaris 10 machine:

find /tmp -name 'core*' -type f -print0 | xargs -0
xargs: illegal option -- 0
xargs: Usage: xargs: [-t] [-p] [-e[eofstr]] [-E eofstr] [-I replstr] [-i[replstr]] [-L #] [-l[#]] [-n # [-x]] [-s size] [cmd [args ...]]
share|improve this question
see if your system has gxargs, possibly in /usr/sfw/bin, or /opt/sfw/bin. Then you can use the GNU specific options. – Tim Kennedy Mar 11 '13 at 13:40
up vote 5 down vote accepted

Both the -print0 to find and the -0 to xargs are not POSIX, and may not be available everywhere. The + command terminator to -exec is part of POSIX, and will accomplish the same task. Here is an example.

find /tmp -type f -name 'core*' -exec rm {} +
share|improve this answer
ok but I cant think right solution and regarding my question , find /tmp -name 'core*' -type f -exec < which other syntax I can put here > in order to print the argument one after one , – yael Mar 7 '13 at 14:10
@yael that's what the + terminator does. – jordanm Mar 7 '13 at 15:15

The --print0 and -0 are GNU extensions. I believe the (almost) full suite of GNU tools is available for Solaris (perhaps under names like gfind, probably not installed by default).

Here is a list of suggested tools to install to make your Solaris experience more pleasant.

share|improve this answer

Use GNU Parallel in place of xargs:

find /tmp -name 'core*' -type f -print | parallel echo

It takes literally 10 seconds to install GNU Parallel:

wget pi.dk/3 -qO - | sh -x

Watch the intro videos to learn more: https://www.youtube.com/playlist?list=PL284C9FF2488BC6D1

share|improve this answer

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.