Help answer threads with 0 replies.
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, 03: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, 03:47 AM   #2
Senior Member
Registered: Dec 2005
Location: Finland
Distribution: Slackware, CentOS, RHEL, OpenBSD
Posts: 1,006

Rep: Reputation: 36
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 03:50 AM.
Old 04-07-2008, 08:44 PM   #3
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,047
Blog Entries: 11

Rep: Reputation: 907Reputation: 907Reputation: 907Reputation: 907Reputation: 907Reputation: 907Reputation: 907Reputation: 907
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 04:23 AM
`wc`, `xargs` h/w Programming 11 09-30-2007 05:22 PM
xargs yawe_frek Linux - Software 1 04-15-2007 05:26 PM
xargs and my own script harmster Linux - Software 4 05-07-2005 11:35 AM
xargs question reitzell Linux - Newbie 4 07-04-2004 03:36 AM

All times are GMT -5. The time now is 10:31 PM.

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