Configure your shell at icarus

General Information

In this webpage I present some modifications to the default icarus shell, so that we can all work under the same environment and all terminals have a rather predictable behavior. Basically, all the modifications are captured in three hidden files (initialization scripts): With these modifications you will be able to (virtually) change the default login shell at icarus (Korn shell - ksh) to the bash shell which I prefer. If you haven't read The basics yet, do so now before you read the rest of this page.
Note: This is one of the very few times that you can bend the rule of touching the mouse while you work at a terminal, since you might want to copy/paste some stuff from the files presented below.

Commenting on scripts

As a rule of a thumb, always comment the script files that you write (as well as your programs). The universal way of writing comments on Unix/Linux scripts dictates that you write down the number sign # and declare that whatever follows that sign is a comment on that line.
[Top] [Terminal HOW-TO]


This file is read by the system when the user logs in. The basic modification is that I call the bash shell when the user logs in, and automatically call the exit command when the bash shell terminates. You can download the file here and place it under your home directory at your icarus account, or copy/paste the contents of the file to your premade .profile file.


This file is executed on startup of (non-login) bash shells. I comment on my changes again inside the file. You can find it here and place it under your home directory. There is probably one thing that you might want to change, and that is the way your primary prompt is displayed. Inside the file I use the incomprehensible command:
export PS1="[\@] \h:\w$ "
which results in the following prompt:
[00:11am] icarus:~$ 
i.e. it prints the current time, the host, my current working directory and a dollar sign.
According to the manual at icarus (man bash) here are the available options (under paragraph PROMPTING):
User Commands                                             BASH(1)

     to  exit  is  made without an intervening command, the shell
     does not print another warning, and  the  stopped  jobs  are

     When executing  interactively,  bash  displays  the  primary
     prompt  PS1  when  it  is  ready  to read a command, and the
     secondary prompt PS2 when it needs more input to complete  a
     command.   Bash allows these prompt strings to be customized
     by inserting a number of backslash-escaped  special  charac-
     ters that are decoded as follows:
          \a   an ASCII bell character (07)
          \d   the date in "Weekday  Month  Date"  format  (e.g.,
               "Tue May 26")
          \e   an ASCII escape character (033)
          \h   the hostname up to the first `.'
          \H   the hostname
          \n   newline
          \r   carriage return
          \s   the name of the shell, the  basename  of  $0  (the
               portion following the final slash)
          \t   the current time in 24-hour HH:MM:SS format
          \T   the current time in 12-hour HH:MM:SS format
          \@   the current time in 12-hour am/pm format
          \u   the username of the current user
          \v   the version of bash (e.g., 2.00)
          \V   the release of bash, version +  patchlevel  (e.g.,
          \w   the current working directory
          \W   the basename of the current working directory
          \!   the history number of this command
          \#   the command number of this command
          \$   if the effective UID is 0, a #, otherwise a $
          \nnn the character corresponding to  the  octal  number
          \\   a backslash
          \[   begin a sequence of non-printing characters, which
               could be used to embed a terminal control sequence
               into the prompt
          \]   end a sequence of non-printing characters

     The command number and the history number are  usually  dif-
     ferent:   the history number of a command is its position in
     the history list, which may include commands  restored  from
     the  history  file  (see  HISTORY  below), while the command
     number is the position in the sequence of commands  executed
     during  the  current  shell  session.   After  the string is
     decoded, it is expanded  via  parameter  expansion,  command
     substitution,  arithmetic  expansion,  string expansion, and
     quote removal, subject to the value of the promptvars  shell
     option (see the description of the shopt command under SHELL

GNU                 Last change: 1999 Jan 20                   43
Experiment with the above options and find the one that suits your needs. I suggest though that you include the parameter \h so that you know instantly in which computer you are working.


This file contains all the aliases of commands that you want to create. You can find my suggested file here and place it under your home directory. As an example, the la command will generate an output like the following:
[00:24am] icarus:~$ la
.bash_aliases   .quotalimits    local.cshrc     mcs260/
.bash_history   .sh_history     local.login
.bashrc         .ssh/           local.profile
.profile        bin/            mail/
[00:24am] icarus:~$ 
Note that names of directories are followed by a slash / (which is the result of -F parameter) and this makes it easy to identify them. Similarly, names of executable files are followed by a star to indicate that these files are executables (although none is presented above).

Back to Terminal's homepage

Last Update: Sunday, January 27, 2008.