Linux: Arrow keys don’t work?

Posted by Christian Ashby on March 26, 2010

Some Linux applications such as sqlplus still use readline to read what you type, which doesn’t properly support arrow keys, home, end, etc in most terminals.

You can fix this with a small wrapper called rlfe (for older Ubuntu/Debian variants) or rlwrap (for RedHat and most new distributions).

Once installed (apt-get install rlwrap for Debian/Ubuntu) you can enable it by default for your user by doing the following:

echo "alias {command}='rlwrap {command}'" >> ~/.bashrc
source ~/.bashrc


Linux and Seagate FreeAgent Drives

Posted by Christian Ashby on March 24, 2010

If you’ve bought a Seagate FreeAgent drive with a view to running it on Linux, be aware that it won’t necessarily work out-of-the-box.

The issue is that after about 1min of use the drive spins down and closes the USB connection, causing mounts to fail and the device to be unusable.

It turns out that the drives include some cunning/annoying (delete as applicable) power saving logic which only correctly works in Windows. The solution is to run the following command as root as soon as the drive is plugged in.

sdparm -clear STANDBY -6 /dev/sdX

If you use your drive regularly then you can make this command run whenever the drive is used, by editing the file /etc/udev/rules.d (you can create the file if it doesn’t exist) and adding the following line:

-c 'echo 1 > /sys/class/scsi_disk/%k/allow_restart'"


Windows: Linking files and folders

Posted by Christian Ashby on March 13, 2010

At first glance it may not be obviously useful, but if you need to link one folder to another, or store a file somewhere else but refer to it within a different folder, you can do so by the very useful mklink command, available in Windows 7 and Vista. There is an alternative for Windows 2000 and XP called ‘junction‘.

To create links, simply open a command prompt (Start->Run->cmd), and type:

  • For files: mklink {destination} {target}
  • For folders: mklink /d {destination} {target}

Note that it may be necessary to become admin to link some files / folders.


VIM – paste mode

Posted by Christian Ashby on March 12, 2010

For Linux users who frequently need to edit files on remote machines in Vim, and want to copy & paste items from websites, you’ll often fall foul of the auto indent feature as pasting data into a terminal window running Vim effectively types them on the command line.

You can disable this by a mode known as ‘paste mode’ – which can be enabled like this:

:set paste

And disabled:

:set nopaste

This effectively ensures that no automatic indents happen during pasting data into your terminal.


Linux: Getting SMART status from 3ware cards

Posted by Christian Ashby on March 9, 2010

3ware RAID cards are a very robust hardware RAID solution which work under Linux.

If you use these cards though, the ’3dm2′ web interface and command line interface only give limited information about the health of the drive.

Fortunately the standard tool smartctl can access the drives as if they were directly connected to the system like this:

smartctl -d 3ware,X --all /dev/twa0

Where X is the index (0…n) of the drive you want to check.


Windows XP – how long is there left?

Posted by Christian Ashby on March 3, 2010

It seems to be a common misunderstanding that Microsoft are dropping Windows XP in July this year. This is not the case! They are in fact dropping support for Windows XP Service Pack 2 only – not the entire operating system, so you need to upgrade to Service Pack 3 as soon as possible.

Microsoft in fact withdrew mainstream support for the XP operating system in April 2009, but they continue to support service packs until 24 months after they are released, which means Service Pack 3 will be retired from general support in April 2011 (it was released in 2008). However, Microsoft will continue to release security patches until April 2014, so you have plenty of time to upgrade. For more information see the Microsoft Site.

If you have problems with installing the service packs, or any other questions, please contact us – we’ll happily give you advice over the phone, and if necessary we can fix your machine for you – at a time and price that suits you.


Windows: Becoming admin

Posted by Christian Ashby on March 2, 2010

Windows Vista and 7 introduced a feature called ‘User Account Control’ which restricts users to running user-level commands without somehow confirming that they want to use administrator privileges. Usually applications (such as installation programs) automatically ask the user whether they want to use those additional privileges.

For the command prompt and other programs you can do one of three things to run them as ‘Administrator’:

  1. Use the icon: Right-click on the shortcut to the program and select Run As...
  2. Permanently select run as administrator: Right-click on the shortcut to the program and select Properties then select Run as Administrator in the Compatibility tab.
  3. Use the search box and a shortcut key: Click Start, then type the program name in the search box. Instead of hitting enter when the program is highlighted above, use CTRL+SHIFT+ENTER.

This feature mimics the ‘sudo’ feature in modern Linux operating systems which allows you to run commands ‘as root’.