Friday 28 May 2010

Linux Basics - Finding Stuff

Something has happened with the latest versions of operating systems. The 'find' option has become ridiculously stupid. It seems that there is a move away from actually searching on the disk for the stuff you want, and towards the machine managing a database of all it's files and searching that when you want to look for something.

Inevitably what you want has either recently been written to the disk or is not in a folder which has been indexed by the search routine. This means you can't find fucking anything. Another brave step into the future, backwards.

Linux, at least, has a useful brute force command line command to find stuff. It is called, sensibly:

find

To use it to find a file in your current folder and all its subfolders, with the letters 'abc' somewhere in the file name, you type:

find . -name "*abc*" -print

If you want to find all OpenOffice spreadsheets in your home folder, you would instead type:

find ~/ -name "*.ods" -print

The squiggle "~" is just a linux way of say "My Home Folder, whatever it is actually called."

I have to use this sometimes when I have built a bit of software from source code, installed it and it has fucking vanished. Some applications hide away their executable files somewhere monumentally stupid. If it isn't in the path, you have no chance of running it. So, you can run:

find /usr/bin/ -name "[name of program]" -print

and it should track it down for you. Helpfully this should also locate the documentation for the software if you drop the /bin bit of the path. If this doesn't work, you may want to try /opt/ instead, or even the surprisingly common /up/the/programmers/arse/.

This command does not rely on bloody stupid index databases and therefore actually stands a decent chance of locating the thing that you want.

The fact that Windows 7 is revered like the coming of the chosen one tells you how fucking frustrating the previous versions were; users go mad for this one just because it bloody works. Well its search function certainly doesn't bloody work. I can't go near it. The result is that I now have to load Ubuntu from a live distribution, mount the Windows disk and then run the find utility just to get my stuff. This does not make me happy.

No comments:

Post a Comment