Configuration and Customisation

Jeremy Sanders

October 2011

Introduction

Applications in Unix are often very configurable, but it takes some experience to know what's achievable and how to do it. I can only give you a flavour of the sort of things you can do. Most configuration for the normal user is done by adding lines of text to configuration files (dot-files, with filenames starting with dots to make them hidden).

Window manager

Your desktop will be a lot friendlier if you use the Gnome desktop environment instead of CDE or fvwm. To enable this, edit your .xsession file. You should comment out each line with a hash (#) except for xrdb and xmotd, and add a line at the bottom saying gnome-session. Remember to leave a blank line at the end. You need to log out and log in to get the new desktop.

emacs

Emacs is an extremely customisable program. It contains an entire programming language (emacs lisp) which allows you to write virtually anything within it (believe it or not, there is a web browser, mail reader, and even bell-ringing software available for it). In its .emacs file you can configure its packages or install new packages. If you want a better default .emacs file than you already have, copy /home/jss/grad_course/dot-emacs as your $\sim$/.emacs file.

Here are some flavours of what you can do (` is a back-tick, ' is an apostrophe or single quote):

  1. Highlight pairs of brackets to help writing coding:
    ;; highlight brackets
    (require 'paren)
    (show-paren-mode 1)
    

  2. Switch on colour highlighting of code and LATEX:
    ;; colour highlighting
      (global-font-lock-mode t)
      (setq font-lock-maximum-decoration t)
    

  3. Use autofill to break paragraphs on lines (for LATEX, useful for writing documents):
    ;; use autofill on text modes
    (add-hook 'text-mode-hook 'turn-on-auto-fill)
    

  4. Don't keep adding new lines by moving cursor down:
    ;; Stop at the end of the file, not just add lines
    (setq next-line-add-newlines nil)
    

  5. Use AucTeX (a much better interface for LATEX editing):
    ;; Use auctex
    (require 'tex-site)
    

  6. Use RefTeX (a useful bibtex and table of contents package):
    ;; use reftex
      ; with AUCTeX LaTeX mode
    (add-hook 'LaTeX-mode-hook 'turn-on-reftex) 
      ; with Emacs latex mode
    (add-hook 'latex-mode-hook 'turn-on-reftex)
      ; use natural science bibliography style
    (setq reftex-cite-format 'natbib)
    

  7. Enable python editing mode:
    (setq auto-mode-alist
            (cons '("\\.py$" . python-mode) auto-mode-alist))
      (setq interpreter-mode-alist
            (cons '("python" . python-mode)
                  interpreter-mode-alist))
    (autoload 'python-mode "python-mode" "Python editing mode." t)
    

tcsh

You can modify the behaviour of your shell, tcsh, using either the .mytchrc file or the .login file. The behaviour is slightly different. If you start a shell by logging in, .login is executed as a script. .mytcshrc is always started when you start a shell. Generally you don't want to put commands that print anything out in .mytcshrc as that breaks applications like rsync who expect a shell to be `clean'. Things you might find useful follow:
  1. Add directories to the path. This means these directories are searched for programs and scripts in addition to the usual directories (e.g. /bin, /usr/bin). Take care, as failing to put ${PATH} mean you lose your current path and it may be difficult to run things.
    # adds /home/username/bin to start of search path
    #  colons separate directories
    setenv PATH /home/username/bin:${PATH}
    
  2. Change the prompt. You can make the prompt tell you useful things (machine, username, time, directory, favourite colour).
    set prompt="%m:%c02> "
    
    or we can even change the titles of xterms:
    set prompt="%m:%c02> "
    if( $TERM == xterm ) then
        set prompt="%{\033]0;%n@%m:%~\007%}$prompt"
    endif
    
  3. Alias commands. Suppose I keep typing d9s instead of ds9 or want to change to a directory often
    alias d9s 'ds9'
    alias ddir 'cd /data/username/somewhere'
    

  4. Run a script every time
    source /home/username/dir/scriptname
    
    # start XANADU
    setenv LHEASOFT /data/star/lheasoft/SunOS_5.6_sparc
    source $LHEASOFT/lhea-init.csh
    

  5. Set a default printer
    setenv PRINTER lp2
    

Personal information

.signature holds a few lines of text that are appended to each of your emails by default. .plan is a file which contains information other people can see if they do finger -l username.

Pine

Pine is quite a useful mail reader. Many of its features are disabled by default to make it easier for the novice. Go to Setup, Config in pine to enable these features:
            [X]  enable-search-and-replace                  
            [X]  enable-sigdashes                           
...
            [X]  signature-at-bottom                        
            [X]  strip-from-sigdashes-on-reply              
...
            [X]  print-index-enabled                        
...
            [X]  enable-aggregate-command-set               
...
            [X]  enable-bounce-cmd                          
            [X]  enable-exit-via-lessthan-command           
            [X]  enable-flag-cmd                            
...
            [X]  enable-full-header-cmd                     
            [X]  enable-goto-in-file-browser                
...
            [X]  enable-partial-match-lists                 
            [X]  enable-tab-completion                      
            [X]  enable-unix-pipe-cmd                       
...
            [X]  save-will-advance
If find these features particularly useful. They include
  1. Switch on search and replace in editor.
  2. Put proper dashes before signature (standard), and put signature in right place
  3. Enable aggregation, which allows you to select messages with `;' (select on text, to, from...) and `:' (select current). You can then use the apply `A' command to do a variety of things with the selected set, or zoom `Z' to just view those selected. You can always change the sorting order of messages with `$'.
  4. Flag `*' marks messages as important.
  5. Bounce lets you bounce messages to someone.
  6. Full header lets you check header of messages with `H'.
  7. Tab completion gives tab completion on file name selection.
  8. Pipe allows you to send a mail to a unix command with `$\vert$'.

Other useful keys in Pine:

  1. ctrl+k - remove line
  2. ctrl+j - justify line

X11

You can change the behaviour of many X Window System programs by editing your .Xdefaults file (you need to login or rerun xrdb for these to work), including default colours and fonts for xterms and emacs. Examples include:
!emacs
emacs*background:       papayawhip

!XMotd
xmotd*background:       gray20
xmotd*foreground:       green3
xmotd*geometry:         +20+20

!XTerm
XTerm*font:             7x14
XTerm*background:       #052005
XTerm*foreground:       papayawhip
XTerm*cursorColor:      papayawhip
XTerm*scrollBar:        true
XTerm*visualBell:       true
XTerm*loginShell:       true
XTerm*saveLines:        512
(run showrgb to get a list of the available colours, or use hex codes to program them.) Man pages usually list available resources.

You can also start programs automatically by editing the .xsession script (may be .xinitrc). For instance you can start another xterm by adding the line xterm &.

xdvi

xdvi stars with a rather strange zoom factor so that only a small part of the page can be seen. If you wish to use a better default zoom factor, edit your .Xdefaults file and modify (add if it is not there) the line
xdvi:shrinkFactor: 18
To get the new zoom factor, log out and log-back in, or run
> xrdb .Xdefaults

About this document ...

Configuration and Customisation

This document was generated using the LaTeX2HTML translator Version 2008 (1.71)

Copyright © 1993, 1994, 1995, 1996, Nikos Drakos, Computer Based Learning Unit, University of Leeds.
Copyright © 1997, 1998, 1999, Ross Moore, Mathematics Department, Macquarie University, Sydney.

The command line arguments were:
latex2html -split 0 -font_size 10pt -no_navigation configuration.tex

The translation was initiated by Jeremy Sanders on 2011-10-02


Jeremy Sanders 2011-10-02