Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 04-03-2008, 02:34 AM   #1
Registered: Jul 2006
Distribution: UBUNTU, CentOS, FEDORA 8
Posts: 474

Rep: Reputation: 30
Using xargs

Hey guys i have a hard time understanding xargs, what is it and what does it do?
Old 04-03-2008, 02:47 AM   #2
Senior Member
Registered: Dec 2005
Location: Finland
Distribution: Slackware, CentOS, RHEL, OpenBSD
Posts: 1,006

Rep: Reputation: 37
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.

Last edited by Zmyrgel; 04-03-2008 at 02:50 AM.
Old 04-07-2008, 07:44 PM   #3
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
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.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Xargs -i problems. Glaurung Linux - Software 2 10-25-2007 03:23 AM
`wc`, `xargs` h/w Programming 11 09-30-2007 04:22 PM
xargs yawe_frek Linux - Software 1 04-15-2007 04:26 PM
xargs and my own script harmster Linux - Software 4 05-07-2005 10:35 AM
xargs question reitzell Linux - Newbie 4 07-04-2004 02:36 AM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:52 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration