Live Chat!

rm complains argument list too long

* * * * * 2 votos

October 20th, 2007 mysurface

There is a limitation of rm command, where you can’t delete a large groups of files with *. For examples,
rm -rf something*
If there are large amount of files initiate with something, rm will fails and complains
/bin/rm: Argument list too long.
The solution is to make use of find, xargs and rm.
find . -name ’something*’ -print0 | [...]

Posted in Common, find, rm, xargs | Hits: 13874 | 5 Comments »

Remove all .svn directories at once

* * * * ½ 2 votos

January 19th, 2007 toydi

When you check out a project code base from a svn repository, each downloaded directory (from top to the deepest) contains a .svn hidden directory that keeps svn’s necessary metadata.
If you want to remove them all at once, here’s one way to do it:
~/project_dir $> find -name .svn -print0 | xargs -0 rm -rf
find [...]

Posted in Common, find, rm, xargs | Hits: 18696 | 4 Comments »

Curl multiple URLs

          0 votos

October 23rd, 2006 toydi

A previous post talked about the usage of curl to request a single URL and display its response header fields. It’s good to know that curl also accepts multiple URLs as arguments.
To display response header information of several URLs:
curl -I http://linuxbyexample.co.nr http://lne.blogdns.com/lbe
When there is a long URL list in a file, use xargs instead:
xargs curl [...]

Posted in Network, curl, xargs | Hits: 7512 | No Comments »

easily extract a column of data from multiple columns

          0 votos

October 2nd, 2006 mysurface

To extract a column of data from multiple column, we can use cut. Usually cut use to extract value from huge trace file or data file such as /etc/passwd.
To extract all available user name from /etc/passwd, you can do this
cut -d”:” -f1 /etc/passwd
Cut extract value line by line, to put all into 1 line, you [...]

Posted in Misc, Text Manipulation, cut, pipeline, xargs | Hits: 11328 | 2 Comments »

xargs use stardard output as parameter for another command

          0 votos

October 2nd, 2006 mysurface

xargs is a command line of findutils package. It is not so common for new user, but it is a very useful tools, let me pick an example to show the usage. Bare in mind, xargs is a kind of combo command use together with other command through pipeline.
I have a list of links to [...]

Posted in Text Manipulation, cat, pipeline, wget, xargs | Hits: 11076 | 9 Comments »