Tips for using Unix

Over the years I have developed and gotten from others useful methods I use in Unix. Every so often I will add to this list. At present it contains tips on X windows, mail processing, appointment calendar, diagrams and figures, text editing, version control, TeX processing, HTML authoring, file searching, saving, and deletion, accessing the web, shell commands, music and video, calculations, working from home or on the road, printing, virtual environments, and password maintenance.

X windows

Mail processing

Appointment calendar

Diagrams and figures

Text editing

Version control

TeX processing

HTML authoring

File searching, saving, and deletion

Accessing the web

  1. Usually you access the web using a browser. You are likely to be happy with firefox. If firefox crashes, it sometimes leaves a lock file that prevents you from starting it again. You can remove that lock this way:
    rm -f ~/.mozilla/firefox/*/{lock,.parentlock}
  2. You might prefer opera or konqueror. For very fast start up but limited features (no JavaScript, for instance), I can recommend dillo. Not all these browsers are installed on our machines, though.
  3. If you find yourself in an environment where you need a text-only browser, consider lynx or www-browser.
  4. If all you want to do is fetch a file given a URL (whether it is http or ftp), you might be happy with wget.
  5. The ncftp program is an enhanced ftp client, knowing how to log in anonymously and remember places you have visited. Such a client lets you navigate the file system of a remote site, if the site allows such ftp access.

Shell commands

  1. Unix provides many different shells to choose among. I prefer tcsh; others like bash. Both provide a way to re-submit commands from your recent history and to edit those commands. Both can read start-up files to establish your favorite settings. For tcsh, the start-up file is ~/.tcshrc; for bash, it's ~/.bashrc.
  2. tcsh lets you specify how you would like commands completed (which happens when you enter the tab key). I suggest you place the following commands in your startup file:
    complete cd 'n/*/d/' # first arg of cd must be a directory
    complete 'dvips' 'n/*/f:*.dvi/' # only dvips the right files
    complete 'xdvi' 'n/*/f:*.dvi/' # only xdvi the right files
    complete 'xpdf' 'n/*/f:*.pdf/' # only xpdf the right files
    bindkey -v # use vi-style commands to edit command lines
  3. You can establish useful command aliases. I use the following frequently:
    alias view 'vi +/\!\!:1/ `grep -l \!\!*`' Edit files containing a given string.
    alias ls 'ls -F' List files with suffixes showing type.
    alias lst 'ls -Llt \!\!* | less' List files newest first.
    alias rm 'rm -i' Remove files carefully.
    alias pd 'pushd' Switch directory, saving old directory on a stack.
    alias nd 'mkdir \!\!$ ; cd \!\!$' Create a new directory and switch to it.
    alias showtar 'gunzip -c < \!\!* | tar tf - ' Display the contents of a tar.gz file.
    alias showbtar 'bunzip2 < \!\!* | tar tf - ' Display the contents of a tar.bz2 file.
    alias maketar 'tar cf - \!\!* | gzip > \!\!$.tar.gz' Create a tar.gz file.
    alias makebtar 'tar cf - \!\!* | bzip2 > \!\!$.tar.bz2' Create a tar.bz2 file.
    alias untar 'gunzip -c < \!\!* | tar xf - ' Unpack a tar.gz file.
    alias unbtar 'bunzip2 < \!\!* | tar xf - ' Unpack a tar.bz2 file.

Music and video

Calculations

Working from home or on the road

Printing

Virtual environments

Password maintenance