Questions tagged [xargs]

Execute a command, passing constructed argument list(s). The arguments are typically a long list of filenames (generated by ls or find) that are passed to xargs via a pipe.

Execute a command, passing constructed argument list(s). The arguments are typically a long list of filenames (generated by ls or find) that are passed to xargs via a pipe.

manpage

45 questions
2
votes
5 answers

Find files containing a string on the whole filesystem

I need to find all the instances of a given string in the whole filesystem, because I don't remember in which configuration files, script or any other programs I put it and I need to update that string with a new one. I tried with the following…
Fabio
  • 1,299
  • 2
  • 13
  • 18
1
vote
1 answer

Why is bzip2 -d running in parallel not fully utilizing cpu resource?

I have 1000 .bz2 files and a 48 core machine. So I decided to run bzip2 -d in parallel to speed up unzipping them. But what I found is that the utilization of cpu under top is very suboptimal. For instance, most of them have status D. Why is that?…
John Jiang
  • 113
  • 3
1
vote
1 answer

Bash script - wait for all xargs processes to be finished

I have written a small bash script for crawling an XML sitemap of URLs. It retrieves 5 URLs in parallel using xargs. Now I want an E-Mail to be sent when all URLs have been crawled, so it has to wait until all sub-processes of xargs have finished…
Alex
  • 322
  • 1
  • 4
  • 12
1
vote
1 answer

Finding strings in files with relative path

I don't understand why this two commands don't provide the same result (the differrence is only relative vs. absolute path), can somebody explain it? annika /srv/www/pages/com.example.www/www/povruc # find /srv/www/pages/com.example.www/www | xargs…
1
vote
2 answers

I need to augment my output to include cat-ing a file in this Bash script

I have a script querying a remote server based on user input and looks for the last modified date of a file. It works, however, contained in the file is a string that I need to have displayed as well and everything I've tried has been for naught. I…
subt3xt
  • 11
  • 1
1
vote
2 answers

find: how to not have errors (stderr) when no files exists

I have a custom script which gzip log files when they are one day old. In my script all errors (stderr) are logged to a file and at the end of the script I use this file to know if its execution was good or not. This part of my code looks like #…
daks
  • 673
  • 7
  • 25
1
vote
4 answers

Cross-platform, human-readable, du on root partition that truly ignores other filesystems

Edit 09/20/2012 I made this way too complicated before. I believe that these commands are actually the simpler way, while still formatting everything nicely. RHEL 5 du -x / | sort -n |cut -d\/ -f1-2|sort -k2 -k1,1nr|uniq -f1|sort -n|tail…
nice_line
  • 149
  • 2
  • 7
1
vote
1 answer

How can I run hunspell on a list of files with xargs?

When I run find . -name "*.html" | xargs hunspell hunspell displays the first file with an spelling error, but won't accept input. I have to ctrl-c to kill it. What causes this? Is there a way to run hunspell across a list of files in a…
Don Branson
  • 207
  • 1
  • 10
1
vote
3 answers

chmod of 400,000 files inside multiple subdirectories?

Howdy... I'm looking to chmod 777 a whole bunch of files. Alternatively, since it's more secure, I could also settle for a chown www:www of these files to make them web accessible. Now, since I have over 400,000 files, sudo chmod -R 777 ./* and sudo…
Julian H. Lam
  • 277
  • 4
  • 13
1
vote
1 answer

SSH to server with xargs

I have a pretty easy problem I'm trying to resolve here. I'm constantly running the (host) command on domains, to get their IPs, then (host) again on those IPs to get their PTRs, then I'm SSHing to that server represented in the PTR: [root@box ~]$…
JacobN
  • 156
  • 2
  • 7
1
vote
2 answers

Wondering why sed isn't working with xargs like I expected

I am wondering why the following command wouldn't work: sudo find . -name index.htm | xargs -0 sudo sed -i 's/pattern1/pattern2/g' When ran the two commands separately, they worked as expected, find found all the files I was needing to change, and…
user58852
1
vote
2 answers

IPTables XARGS commands in shell script with no terminal

I am trying to configure an iptables rule that finds a matching IP and deletes as many instances it finds in a one liner. I have the command and it works in a traditional shell environment with path variables. This one is running without a shell…
1
vote
1 answer

Linux cp specific files from a text list of files to subdirectories from a text list too?

I ask for your help to solve my problem because I am stuck. I explain the situation to you: I want to copy files whose path I have on a txt file in specific subdirectories specified in a second file (I also have a complete csv file including these 2…
Carole31
  • 11
  • 1
0
votes
1 answer

capture process that keeps changing PID

i have the following: netstat -anp | grep ':36084 ' | grep CLOSE_WAIT | awk '{print $7}' | cut -d \/ -f1 | grep -oE "[[:digit:]]{1,}" this returns a process PID i want to inspect and find out more about the actual process, where it is being…
khinester
  • 203
  • 1
  • 9
0
votes
1 answer

Run GNU parallel commands in different folders

I'm trying to run commands in parallel. But these commands need to be run in different directories. How can I achieve this? Can I do something like this: parallel ::: 'cd platform1 && npm install && npm run build-all' 'cd platform2 && npm install &&…
masterforker
  • 103
  • 2