Posts

Showing posts with the label xargs

How To Use xargs To grep (or rm) a Million Files

Image
Sometimes even when a tidbit of technology one is studying is already very well documented, one still seeks to test it out for oneself to get a solid sense of the true behaviour of the subject. Plus, if you're like me, writing about a particular subject has the added benefit of committing it to memory. And so it is for the reason of teaching myself that I document these already well-known points about grep and xargs. Of course, as a side-effect, if another out there ends up learning from my writings too, that would be perfectly fabulous in my eyes as well. Basically, the question in my mind is this: How do I successfully grep(search) for something in a directory that contains hundreds of thousands, or perhaps more individual files? To illustrate an example: Using the grep command by itself to search through hundreds of thousands of files provides the following result on my Ubuntu 12.04 GNU/Linux system. The below directory contains 200,000 files. $ grep 'rubies'...