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.

Friday 21 May 2010

Further Adventures in the land of Leave My Fucking Screen Alone

Right. Apparently, the problem is that all the lovely gui interfaces that come with ubuntu do not know how to talk to the xserver properly when it comes to things like bloody screen savers.

This means command line people.

If you type in:
xset q

the system should show you some settings relating to the xserver. These are the settings that should be, but actually are not, changed in the Screensaver and Power Management programs that you launch from System -> Preferences.

What you are looking for is the section:
Screen Saver:
prefer blanking: yes allow exposures: yes
timeout: 0 cycle: 0

If you do not want a blanking screen they should look like the above. If they actually show "timeout: [some number of seconds probably 600]" then you will be enjoying screen blanking hell.

So, you type in:
xset s 0

to disable the screensaver timeout.

Now, you should be able to leave the machine for more than 10 minutes without frantically wiggling the mouse or hitting random keys to keep it alive. Why in the name of sanity the Preferences settings DO NOT ACTUALLY CHANGE this setting is a complete fucking mystery to me. I mean really, what is the fucking point of having a Preferences dialogue for this setting anyway? It doesn't actually change anything, other than my blood pressure. Here is a bug report on what appears to be this issue going back to 2006.

Apparently, if you want this change to be permanent you need to stick the following lines into your /etc/X11/xorg.conf file. Oh yes, that should be fun. Editing xorg.conf is a shortcut to corrupting your display and having to sacrifice your first born to get a graphical user interface back. Use at your discretion, and for fuck's sake keep a backup and have a LiveCD on standby.
Section “ServerFlags”
Option "BlankTime" "0"
Option "StandbyTime" "0"
Option "SuspendTime" "0"
Option "OffTime" "0"
EndSection

Now, back to using F1 Live Timing without the screen going dark in the dying moments of Q3 a-fucking-gain.