tutes-dump/site-tutorials/FAQ/TECHIES/02

69 lines
2.1 KiB
Plaintext
Executable File

[02] HOW DO I CONFIGURE MY ENVIRONMENT SETTINGS AT LOGIN?
This file (.profile) is already setup for you with some generic defaults.
In the file you will find information on customizing your session. You
can edit the file directly using an editor (emacs, ed, vi or pico). Note
that any changes to the file effect future login sessions.
--- UNIX Shell HACKS ---
If you are using the UNIX Bourne Shell or Korn Shell, you need to
be aware of the ".profile" file in your home directory. This acts
as an init file by setting up various environment variables and
such. If a ".kshrc" file is present and you are using the Korn
Shell, then those variables, functions and aliases will also be
loaded.
[ ENV SETTINGS ]
A typical .profile looks much like this:
MAIL=/usr/mail/$LOGNAME
TERM=vt100
LINES=24
COLUMNS=80
EDITOR=/bin/ed
VISUAL=/usr/bin/vi
HZ=60
PS1="$ "
PS2="> "
stty erase '^h' intr '^c' echoe
export MAIL TERM LINES COLUMNS EDITOR VISUAL HZ
For both the Bourne and Korn shells, the default for PS1 is "$".
If you'd rather have the current directory for your prompt, here
is a ksh hack to do it. Put this function in your .kshrc file.
chdir ()
{
\cd ${*:-$HOME} ** PS1="$(pwd)> "
}
alias cd=chdir
Another way of doing this without defining a function and alias
would be a hack on the PS1 environment variable itself:
PS1=['$?:${PWD#${PWD%/*/*/*}/}> '
This hack also gives you the return code for the last command executed.
For the novice user, both of these are useful. Being able to make
aliases like:
alias dir=ls -xsFb
make using UNIX a little bit easier.
To get a list of processes currently being run by your userid, type:
ps -U $LOGNAME
If you have a process running that you wish to terminate (but don't
have a TTY associated with it) get the pid, then use the kill command:
kill -HUP <pid> (other signals include -9)