Sunday, August 20, 2006

Start GNU Screen Automatically

GNU Screen is a very useful program that creates multiple interactive shells inside one physical terminal. It is extremely useful for system administrators and for using with SSH connections and tunnels. See the webpage for more information, guides and manuals.

To have screen start automatically upon login, add the following line to ~/.bash_profile.
exec /usr/bin/screen

Add the following to ~/.bashrc. This produces a message acknowledging screen is activated.
if [ "$TERM" = "screen" ]; then
echo "[ screen is activated ]"

Add the following to ~/.screenrc. It prevents screen from popping up its startup message; and defines the number of scrollback lines available.
startup_message off
defscrollback 10000

Finally, to force xterm to start bash as a login shell (so that bash reads ~/.bash_profile), add the following line to ~/.Xresources. (This will have to be modified appropriately for other terminals.)
Xterm*loginShell: true

You can implement the changes to ~/.Xresources with the following command.
xrdb ~/.Xresources

Friday, August 18, 2006

Vi editing mode on the command line

To set the default command line editing mode to vi (instead of emacs), add the following to ~/.inputrc.
set editing-mode vi
set keymap vi-insert
Or add the following to ~/.bashrc.
set -o vi

Xmodmap on login.

I use xmodmap to change a few keybindings. This post describes how to get xmodmap to load your settings upon login.

Create ~/.xinitrc (or maybe ~/.xsession) with two lines: the first loads your xmodmap file; the second starts the windowmanager. Since I am using xfce4, my .xinitrc file looks like so.
/usr/bin/xmodmap ~/.xmodmaprc
exec /usr/bin/startxfce4
Exit. At the login screen change the "session" setting to "Default System Session" and log in.

Here is my .xmodmaprc file.
keycode 112 = 30

! Swap Caps_Lock and Control_L
! since my pinkie hurts.

remove Lock = Caps_Lock
remove Control = Control_L
keysym Control_L = Caps_Lock
keysym Caps_Lock = Control_L
add Lock = Caps_Lock
add Control = Control_L

! bind the menu key to the right control key
! since my laptop does not have a right CTRL.

keycode 117 = Control_R
add Control = Control_R

! On the Compaq Presario 2800CA, the the following
! keycodes are listed for the special keys at the
! top of the keyboard.
! 163 i
! 158 envelope
! 154 magnifying glass
! 239 music note
! 174 - (volume down)
! 176 + (volume up)

keycode 174 = F18
keycode 176 = F19

Two-Finger Scrolling on the Trackpad

Pre-requisites. You will need the xorg-dev package.
apt-get install xorg-dev
(You must also have compliers and libraries installed; see the Xubuntu 6.06 LTS post.)

Install the new Synaptics driver. The included synaptics mouse driver does not support two-finger scrolling, but the latest one does (0.14.6). So download the latest synaptics driver.
Extract and compile using 'make'.

Copy synaptics_drv.o into place. (I crashed my systems doing this, so you
may want to exit X before you put the driver in place.)
cp synaptics_drv.o /usr/lib/xorg/modules/input/
Now edit the InputDevice section of your xorg.conf file. My InputDevice section now reads like so.
Section "InputDevice"
Identifier "Synaptics Touchpad"
Driver "synaptics"
Option "SendCoreEvents" "true"
Option "Device" "/dev/psaux"
Option "Protocol" "auto-dev"
Option "HorizScrollDelta" "0"
Option "HorizTwoFingerScroll" "1"
Option "VertTwoFingerScroll" "1"
(I only added the two *TwoFingerScroll options.)

Restart X.

Firefox. In about:config make the following changes.
mousewheel.withnokey.action 0
mousewheel.withnokey.numlines 1
mousewheel.withnokey.sysnumlines false
mousewheel.horizscroll.withnokey.action 0
mousewheel.horizscroll.withnokey.numlines 1
mousewheel.horizscroll.withnokey.sysnumlines false
general.smoothScroll true

More Post-Installation Packages

Image Magick for image manipulation.
  • apt-get install imagemagick
  • apt-get install xnest
LaTeX macros for Vim.
  • aptitude install vim-latexsuite
The Amarok music player.
  • apt-get install amarok amarok-xine
Terminal program for changing audio settings.
  • apt-get install aumix
Download the Debian package for skype from, then
  • dpkg -i skype*.deb (This is included in Ubuntu, but not in Xubuntu.)
  • apt-get install
Radeon tool: for effecting changes on Radeon graphics cards.
  • apt-get install radeontool
More games: the Multiple Arcade Machine Emulator; and a gui frontend.
  • apt-get install xmame-x
  • apt-get install kxmame

Xubuntu 6.06 Installation

I installed Xubuntu 6.06 because I wanted to try XFce4.

Initial impression: XFce is quite nice and seems fast. I just need to learn the keyboard shortcuts.

Post-Installation: Followed some of the suggestions on; did the following.

Add networking information (essid, keys, etc.).
  • vi /etc/network/interfaces
  • /etc/init.d/networking restart
Update and Upgrade.
  • apt-get update
  • apt-get upgrade
Copy my xorg.conf into place.
  • cd /etc/X11
  • mv xorg.conf{,.original}
  • cp /scratch/etc/X11/xorg.conf .
Edit sources.list.
  • cp sources.list sources.list.original
  • vi sources.list
  • apt-get update
Install Microsoft fonts.
  • apt-get install msttcorefonts
Install mutlimedia codecs.
  • wget -c -O /tmp/w32codecs.deb
  • dpkg -i /tmp/w32codecs.deb
  • apt-get install libdvdread3
  • /usr/share/doc/libdvdread3/examples/
Install mutlimedia players.
  • apt-get install lame sox ffmpeg mjpegtools mpg321 vorbis-tools
  • apt-get install mplayer
  • sed -i.backup -e's@vo=x11,@vo=xv,@g' /etc/mplayer/mplayer.conf
  • apt-get install sound-juicer
Install Acrobat Reader.
  • apt-get install acroread
Install Flash plugins.
  • apt-get install flashplugin-nonfree
  • update-flashplugin
Install Java (Sun).
  • apt-get install sun-java5-jre sun-java5-plugin
  • update-alternatives --config java
Install LaTeX.
  • apt-get install tetex-base tetex-bin tetex-extra gv xpdf-reader texinfo texi2html dvipng sam2p tetex-doc dialog psutils
Install Octave (Matlab replacement) and Gnuplot.
  • apt-get install octave
  • apt-get install gnuplot{,-doc}
Install subversion.
  • apt-get install subversion
Install vim-gtk and set it as the default editor.
  • apt-get install vim-gtk vim-doc
  • sed -i.backup.gvim -e's@gedit.desktop@gvim.desktop@g'
  • sed -i.backup
    -e's@NoDisplay=true@NoDisplay=false@g' /usr/share/applications/gvim.desktop
Install games.
  • apt-get install supertux
  • apt-get install frozen-bubble
Install Openssh-server.
  • apt-get install openssh-server
Install basic compilers and libraries.
  • apt-get install build-essential manpages-dev

Linux Wisdom

The following posts document various linux tasks.

For the record, I generally use Ubuntu, most recently Xubuntu.