Linux tricks and bits

This page contains linux tricks that I keep looking up and forgetting. Mostly they'll be quite basic.

Bibtex

  • Bibtex style file database -- organized by journal names
  • JabRef -- Open source reference manager. Great thing is: it can import bibtex entries directly from Medline (give it a medline identifier, and it'll generate a bibtex entry). Under ubuntu, you may have to run sudo update-alternatives --config java and choose the sun alternative -- if it complains. That worked for me... See also the official faq.

Firefox

Two really great plugins for firefox (which are the main reason I use it next to konqueror):
  • FlashBlock blocks those annoying flash adverts and replaces them with a unobtrusive little image
  • SwitchProxy adds a toolbar which allows you to change proxies with a single click. Extremely useful if you often have to change proxies

Random cool programmes

  • sshfs -- allows you to mount and nfs filesystem over ssh. However, I had a few isseus getting it working. There's some notes here.
  • partimage allows you to back up a compressed version of your partition and restore it, for example if some upgrade goes wrong.

Konqueror

Web shortcuts

This is probably the most useful feature of konqueror, at least to me. Hit ctrl-l, which gets you to the address bar, and then use for example gg:benzodiazepines to search for benzodiazepines on Google, without going through Google's homepage. And you can configure lots of these shortcuts (go to Settings>Configure Konqueror>Web shortcuts). This page describes how to concoct them. A few I made and use a lot are:
  • Google scholar: gs: http://scholar.google.com/scholar?q=\{@}
    gsa: http://scholar.google.com/scholar?q=author:\{@}
    The first one simply searches Google scholar with the full query you give it, while the latter prepends author: to the query.
  • Pubmed: pm: http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?CMD=search&DB=PubMed&term=\{@}
    pma: http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?CMD=search&DB=PubMed&term=\{@}[au]
    pmay: http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?CMD=search&DB=PubMed&term=\{@}[au]\{y}[dp]
    Again, the first one simply searches Pubmed with the full query you give it, while the second appends the author tag [au] to the query (you still have to give it the AND between the authors). The third one allows searches for several authors and additionally for a year if a search term like y=1999 is present.
  • Amazon.co.uk: http://www.amazon.co.uk/exec/obidos/external-search/field-keywords=\{@}
  • Sed

    For now, just a link to a tutorial.

    Screen>

    This is a great overview over how to use screen non-interactively: Scripting screen.

    VNC

    VNC allows you to view your desktop on a remote machine. And it's super-easy to use. I assume your local machine has vncviewer, and the remote machine has vncserver and vncpasswd installed. Here I'll go through the steps to set up a vnc server and use ssh to access it remotely.

    1. run vncpasswd on the machine the desktop of which you'll want to see remotely and choose a password. Let's call that machine snoopy.
    2. On snoopy, also run vncserver :3. This starts your session, but in the background -- you can't see it until you connect to it.
    3. Now assume you're sitting at a different machine in a different bit of the world and you want to connect to the vncserver you just set up. First open an ssh connection to that machine, by runninng ssh -CL 5903:localhost:5903 www.wheretheserversits.com. This opens a secure connection from your computer to www.wheretheserversits.com. The connection listens to port 5903 (vnc uses ports 59xx. vncserver :3 uses port 5903) on your local machine localhost and forwards it to port 5903 of the machine that sits behind www.wheretheserversits.com.
    4. Now either this is same machine snoopy on which you've set up the vnc server, in which case you can jumpt to the next point, or snoopy is some other machine. In that case, you need to set up a ssh connection from the machien that listens to www.wheretheserversits.com to snoopy, again forwarding the correct ports. So now just run ssh -CL 5903:localhost:5903 snoopy. Now, whatever you send to port 5903 on your machine at home, is sent to port 5903 of the server behind www.wheretheserversits.com. There, our new ssh process listens, and forwards it on to port 5903 on snoopy. Cool eh?
    5. Final point: To run the vncviewer and actually see the remote desktop, hit vncviewer :3 on your home machine. It should now ask you for the password you specified when you ran vncpasswd, and a desktop should pop up.
    6. One more point: the key F8 is the magik key -- it'll allow you to log out of the vnc viewer, convert to and from full screen etc.

    Wireless

    To scan for wireless networks on a linux box, type iwlist eth1 scan and of course replace eth1 by your wifi's device name. To latch onto the network found, just type iwconfig eth1 essid ESSID and replace ESSID with the essid of the desired network.

    Xfig

    Under ubuntu 6.10, my xfig suddenly stopped working, telling me it couldn't find the fonts. On the web, I found this very useful comment, which fixed things for me: sudo dpkg-reconfigure locales
    xset fp rehash