Here are samples of some of the files described in this guide.
The system runs your .profile whenever you log in. When you create a new user account, the user's initial .profile is copied from /etc/skel/.profile. Here's what's in that file:
# default .profile if test "$(tty)" != "not a tty"; then echo 'edit the file .profile if you want to change your environment.' fi
This profile runs the tty utility to get the name of the terminal that's open as standard input. If there is a terminal, .profile simply displays a helpful hint.
You might want to set some environment variables:
- The path to your favorite editor (the default is elvis ).
- The name of the profile that ksh should run whenever you start a shell.
The code for these changes could look like this:
export EDITOR=/usr/local/bin/jed export ENV=$HOME/.kshrc
Here's an example of a profile that ksh runs if you set the ENV environment variable as described above for .profile:
alias rm="rm -i" alias ll="ls -l" export PS1='$(pwd) $ '
This profile does the following:
- Uses an alias to turn on interactive mode for the rm command. In interactive mode, rm asks you for confirmation before it deletes the file. The cp and mv commands also support this mode.
- Creates an alias, ll, that runs ls with the -l set. This gives a long listing that includes the size of the files, the permissions, and so on.
- Changes the primary prompt to include the current working directory
(the default if you aren't root is $). You can also
change the secondary prompt by setting PS2.
Note that you should use single quotes instead of double quotes around the string. If you specify:
export PS1="$(pwd) $ "
the pwd command is evaluated right away because double quotes permit command substitution; when you change directories, the prompt doesn't change.
Last modified: 2014-11-17