home *** CD-ROM | disk | FTP | other *** search
/ norge.freeshell.org (192.94.73.8) / 192.94.73.8.tar / 192.94.73.8 / pub / sdf / faq / HACKER / 02 < prev    next >
Text File  |  2003-11-12  |  2KB  |  69 lines

  1. [02] HOW DO I CONFIGURE MY ENVIRONMENT SETTINGS AT LOGIN?
  2.  
  3.      This file (.profile) is already setup for you with some generic defaults.
  4.      In the file you will find information on customizing your session.  You
  5.      can edit the file directly using an editor (emacs, ed, vi or pico).  Note
  6.      that any changes to the file effect future login sessions.
  7.  
  8.      --- UNIX Shell HACKS ---
  9.  
  10.      If you are using the UNIX Bourne Shell or Korn Shell, you need to
  11.      be aware of the ".profile" file in your home directory.  This acts
  12.      as an init file by setting up various environment variables and
  13.      such.  If a ".kshrc" file is present and you are using the Korn
  14.      Shell, then those variables, functions and aliases will also be
  15.      loaded.
  16.  
  17.      [ ENV SETTINGS ]
  18.  
  19.      A typical .profile looks much like this:
  20.  
  21.          MAIL=/usr/mail/$LOGNAME
  22.          TERM=vt100
  23.          LINES=24
  24.          COLUMNS=80
  25.          EDITOR=/bin/ed
  26.          VISUAL=/usr/bin/vi
  27.          HZ=60
  28.  
  29.          PS1="$ "
  30.          PS2="> "
  31.  
  32.          stty erase '^h' intr '^c' echoe
  33.  
  34.          export MAIL TERM LINES COLUMNS EDITOR VISUAL HZ
  35.  
  36.      For both the Bourne and Korn shells, the default for PS1 is "$".
  37.      If you'd rather have the current directory for your prompt, here
  38.      is a ksh hack to do it.  Put this function in your .kshrc file.
  39.  
  40.          chdir ()
  41.          {
  42.             \cd ${*:-$HOME} ** PS1="$(pwd)> "
  43.          }
  44.  
  45.          alias cd=chdir
  46.  
  47.      Another way of doing this without defining a function and alias
  48.      would be a hack on the PS1 environment variable itself:
  49.  
  50.          PS1=['$?:${PWD#${PWD%/*/*/*}/}> '
  51.  
  52.      This hack also gives you the return code for the last command executed.
  53.  
  54.      For the novice user, both of these are useful.  Being able to make
  55.      aliases like:
  56.  
  57.           alias dir=ls -xsFb
  58.  
  59.      make using UNIX a little bit easier.
  60.  
  61.      To get a list of processes currently being run by your userid, type:
  62.  
  63.           ps -U $LOGNAME
  64.     
  65.      If you have a process running that you wish to terminate (but don't
  66.      have a TTY associated with it) get the pid, then use the kill command:
  67.  
  68.           kill -HUP <pid>     (other signals include -9)
  69.