Monday, December 13, 2010

The Most Basic Possible Screen Tutorial

Screen is neat. It allows you to start long running processes (like fsck or a big network copy) and then log out.

Also if you're getting into your box over ssh or something, it preserves the login if the connection goes down. I imagine that it survives the death of X and other unfortunate events also.

Screen's neat. But I can never remember how to use it when I need it. This is for me:

Install it:
$ sudo apt-get install screen

Start a terminal.
In this terminal type:
$ screen

There will be a screen full of crap: Press Return to make it go away, and wait a second or so.
Apparently you will be back at a terminal. But it is really a screen session.

Start a long-running task:
$ htop

Detach from your session using C-a d (ie, hold down control, press a, release control, press d)

You are back at your terminal:

Kill it:
$ exit

Now switch to a virtual console with Alt-Ctrl-F1

log in

Reattach to the screen session
$ screen -r

You should have htop running before your eyes.

Detach from your session with C-a d

Switch back to X with Alt-Ctrl-F7

Open a terminal

Reattach to screen with
$ screen -r

Exit from htop with F10 (actually your terminal emulator may catch F10 and do something with it. Getting out of htop is then left as an exercise for the reader.)

You are back at a terminal which is really a screen session

Exit from the screen session with
$ exit

Everything is back to normal.

Here's an ever so slightly less basic tutorial:
http://www.howtoforge.com/linux_screen

Sunday, December 12, 2010

Finding USB disks and external harddrives

$ sudo fdisk -l

will list all disk drives and their partitions, allowing you to find out that your usb disk has attached itself to /dev/sdh today.

Wednesday, November 10, 2010

System-wide installation of an R package from CRAN

Installing 'brainwaver'

Run R as root (!)

$ sudo R

And then at the R prompt, type:

> install.packages('brainwaver', dep = TRUE)

This should also pull in the waveslim package on which brainwaver depends.

It will pop up a window with a list of mirrors to download from. I chose London.

Now get out of R before you forget that you're running as root and do serious damage to your system.

You can verify that it's worked by trying

> help(brain)

at the prompt.

When things go wrong.

I next tried to install odfWeave in the same manner.

All seemed well, and it pulled in a package XML as a dependency, but while installing XML,
there was a bunch of output, which looked like a configure script running.

Things obviously went wrong at about this point.


checking for xml2-config... no
Cannot find xml2-config
ERROR: configuration failed for package ‘XML’
* removing ‘/usr/local/lib/R/site-library/XML’

Luckily typing xml2-config at the prompt gave:

$ xml2-config
The program 'xml2-config' is currently not installed.  You can install it by typing:
$ sudo apt-get install libxml2-dev

So I installed libxml2-dev as suggested, and then Bob was my uncle.


Monday, October 11, 2010

OpenOffice Calc Auditing Toolbar

The immensely useful 'Auditing Toolbar' facility of Excel has for no apparent reason been renamed the Data Detective in OpenOffice, and can be found on one of the menus rather than as a toolbar.

It allows you to trace which cells your values depend on, and which they influence. Sort of like a debugger for a functional language without recursion.

Sunday, October 10, 2010

Ubuntu 10.04 NVIDIA restricted driver

Use restricted driver thingy to install nvidia driver. Everything is dead. No idea why.

at command line sudo nvidia-xconfig creates an xorg.conf file, after that it seems to work.

Ubuntu Wireless Connection from Command Line (WPA-PSK)

It can be useful to make a connection from the command line, without having to use the network manager. This is the magic incantation:

$ sudo ifconfig wlan0 down && sudo dhclient -r wlan0 && sudo wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant.conf -dd & sudo dhclient wlan0

And the file /etc/wpa_supplicant.conf should contain:

ap_scan=1
ctrl_interface=/var/run/wpa_supplicant

network={
        ssid="YOUR_NETWORK_NAME_HERE"
        scan_ssid=0
        proto=WPA
        key_mgmt=WPA-PSK
        psk="PASSWORD"
        pairwise=TKIP
        group=TKIP
}

Thursday, September 23, 2010

Taking a Screenshot in Ubuntu

$ sudo apt-get install imagemagick
$ import MyScreenshot.png

Click and drag the rectangle you'd like a photo of.