Archive

Posts Tagged ‘search’

Useful Linux Commands: Find and Search

September 1st, 2008

Learning Linux commands is probably the largest hump anybody new to Linux faces. Over the last year, I’ve compiled some useful, and somewhat non-obvious scripts that are really helpful to me on a weekly basis. Here are commands that deal with finding files and searching for text within a file:

Find and delete a directory:

find /PATH/TO/DIR -type d -name SEARCH -exec rm -rf {} \;

Find and delete a file:

find /PATH/TO/DIR -name SEARCH -exec rm -rf {} \;

Search within files:

 grep -r "SEARCH" *.EXTENSION /PATH/TO/DIR

Find and search within files:

find /PATH/TO/DIR -name "SEARCH" | xargs -I{} grep -H SEARCH {}

For more advanced options there’s always:

man find
man grep

linux , , , , , , , , , , , , ,

Removing Trackerd

August 27th, 2008

Trackerd is probably the least useful tool that comes with Ubuntu. While indexing, it maxes out cpu and memory. Of course it allows you to search, but the search never finds what I’m looking. In my experience, i’ve found that find and grep are much more useful, especially if its only within a subdirectory.

Trying to remove trackerd is much harder than one would think. Using apt/aptitude proved fruitless since trying to remove/purge trackerd or tracker-utils does absolutely nothing. From Travis, I use these two scripts to basically prevent trackerd from running:

killall trackerd
mv /usr/bin/trackerd /usr/bin/trackerd-old

You might want to use ‘whereis trackerd’ to find out where your trackerd binary is actually located before using the move command.

linux , , , , , , , ,