-   Linux - General (
-   -   Using xargs (

SBN 04-03-2008 03:34 AM

Using xargs
Hey guys i have a hard time understanding xargs, what is it and what does it do?

Zmyrgel 04-03-2008 03:47 AM

You can pipe a list of arguments to xargs which can apply other commands to it.


find $HOME -name *.jpg | xargs ls -l
Makes a detailed list of jpg files in home directory by applying 'ls -l' to all files found by find.

You could use find's '-exec' option above but xargs is faster than that.

Tinkster 04-07-2008 08:44 PM

And to explain the WHY of xargs ... when you have a direcotry with MANY
files, and use shell globbing of sorts you may encounter errors a la
"argument list too long" or "too many arguments".

xargs allows you to work around that.


All times are GMT -5. The time now is 09:57 PM.