skip to main content

Warning: Remember to be careful in editting your start-up files.  If you make harmful changes, you might not be able to log in next time. Use the command " getskel " to retrieve copies of the original startup files.  This command will also save backup copies of your current startup file in your home directory.  (full path of getskel is /usr/local/ews/getskel )

Changing Shells If you wish to change you shell, you may do this via emailing engrit-help [at] illinois.edu. You will be prompted for your NetID password and then you can select a different shell. Supported Shells and their descriptions are listed below.

 

Csh

.cshrc File The .cshrc file is run every time you start a new C-Shell, whether you open a new terminal window, run a shell script or just type csh at the prompt. The .cshrc file should hold commands and definitions that you ALWAYS want to run.
.login File

The .login file is run for each login C-Shell you run. A login C-Shell is exactly the same as a regular C-Shell except that the login shell runs the .login file. Usually when you log in, the first shell that is run is a login shell, and subsequent ones (i.e., one run because of shell scripts, etc.) are non-login shells. However, each terminal window you start under the default EWS setup on the workstations runs a login shell.

Thus, The .login file should contain commands and definitions that you want run ONLY when you log in, for example, setting the terminal type.

Path

When you are issued your account, the .cshrc file contains only one executed line, which is:
source /usr/local/ews/system.cshrc

This line calls the file /usr/local/ews/system.cshrc and runs it. This file contains a few environment settings and commands to set up your working environment. Note that this file is not the same throughout all machines in the EWS labs--each type of system (i.e., Sun, HP) has its own /usr/local/ews/system.cshrc , so if you log into a Sun, you do not run the same file as when you log into an HP. These different files allow us to account for minor differences in the various operating systems.

NOTE : If you modify the .cshrc file, you must be careful to take into account differences between the different systems. Failure to do so can result in problems using a particular type of system.

In other words, do not place HP-specific commands in your .cshrc file, for if you ever log into a Sun system, you may find that the command either does not work at all or does not have the same effect (or, even worse, has a destructive effect).

To account for these differences, the /usr/local/ews/system.cshrc file defines an environment variable called ENVIRON to be the ~e of system you are running on. It can take values of SUN, or HPUX, depending on what type of system you are using.

NOTE : YOU MUST LEAVE THE LINE source /usr/local/ews/system.cshrc IN YOUR .cshrc FILE FOR THE ENVIRON VARIABLE TO BE DEFINED.

Example.cshrc File :
Here's an example of a modified .cshrc file. In this file, the user wishes to make changes to his path and create a few aliases, but because of differences in machines, he must take into account which machine he is logging into.

#Sample .cshrc file
#
#DON'T REMOVE THIS NEXT LINE!
source /usr/local/ews/system.cshrc
#
#Now that we've done the system-specific stuff, we can
#add our own commands.
#
#If we're on a Sun system, we want to be able to use
#Common LISP and define plist to give a full process list.
#
if ($ENVIRON = = SUN) then
set path=($path /usr/local/bin)
alias plist "ps -aux"
endif
#
#OK, we're all done!
#

Ksh

Command History

Using the shell history is useful if you don't want to retype commands that you have already typed. In ksh, once you have set up the history in your .profile , just hit the escape key and then use keys corresponding to vi commands to get back to the command that you want to execute.
The keys that you would use are:

k= go up
j= go down
l= go right
h= go left
i= insert
a= append

For example, let's say that you have typed three commands so far:

Linuxprompt >ls -al
Linuxprompt >wcwho -re someuser
Linuxprompt >blahblahblah

Now let's say that you want to use the command wcwho -re someuser, but don't want to have to retype all of that again. You would use these steps to execute the command:

Hit the escape key
Use the letter k to scroll up until you see the command that you want to execute hit enter to execute the command.

For a more advanced example, let's say that you wanted to type wcwho -re someotheruser, but didn't want to have to type the wcwho -re part again. You would use these steps to execute and edit the command from your history:

Hit the escape key
Use the letter k to scroll up until you see the command that you want to execute. Use the l key to move to the right until you get to the part that you want to delete and replace with something else. Hit the right arrow key and then insert your additional text.

As you use ksh, you will learn more and more tricks and all of this will seem easy to you even though it may be difficult at first. To help you in your study of ksh, refer to the manual entry for ksh. The command that you would type to access the page is:
Linuxprompt >man ksh

Exporting
Your
Display

Unlike csh and tcsh, which use the command "setenv", ksh uses the command "export" to export display windows from other workstations. However, if you are using an EWS workstation, you simply need to type:
ssh remote_machine_name

Then type your password. ssh figures out the rest for you and exports your display (encrypted) to whatever workstation you are working at.

Other
Features
of ksh

Most of the widely used features of ksh including customizing your prompt are implemented in the .profile. Please see the page on using a .profile for more information.

Tcsh

Description

The tcsh shell is a superset of the csh shell.  It was designed to add more functionality to csh .  As a superset, it has many of the same features as csh.

.cshrc File The .cshrc file is run every time you start tcsh, whether you open a new terminal window, run a shell script or just type csh at the prompt. The .cshrc file should hold commands and definitions that you ALWAYS want to run. There is also the possibility of using a .tcshrc file, but using the .cshrc file will work in lieu of a .tcshrc file.
.login File

The .login file is run for each login tc-Shell you run. A login shell is exactly the same as a regular shell except that the login shell executes the .login file. Usually when you log in, the first shell that is run is a login shell, and subsequent ones (i.e., any run because of shell scripts) are non-login shells. However, each terminal window you open in X under the default EWS setup on the workstations runs as a login shell. 

Thus, the .login file should contain commands and definitions that you want run ONLY when you log in, for example, setting the terminal type.

You are provided a default . login file on your EWS account.

Path

When you are issued your account, the .cshrc file contains only one executed line, which is: 

source /usr/local/ews/system.cshrc  

This line calls the file /usr/local/ews/system.cshrc and runs it. This file contains a few environment settings and commands to set up your working environment.  

NOTE : YOU MUST LEAVE THE LINE source /usr/local/ews/system.cshrc IN YOUR .cshrc FILE FOR THE ENVIRON VARIABLE TO BE DEFINED.

Example .cshrc File :
Here's an example of a modified .cshrc file. In this file, the user wishes to make changes to his path and create a few aliases, but because of differences in machines, he must take into account which machine he is logging into. 

#Sample .cshrc file 
#
#DON'T REMOVE THIS NEXT LINE! 
source /usr/local/ews/system.cshrc 

#Now that we've done the system-specific stuff, we can 
#add our own commands. 

#If we're on a Sun system, we want to define plist to give a
#full process list. 

if ($ENVIRON == SUN) then 
alias plist "ps -aux" 
endif 

#If we're on an HP, we want to be able to use JDK 
#and define plist as for the Suns. 

if ($ENVIRON == HPUX) then 
set path=($path /usr/local/bin) 
alias plist "ps -ef" 
endif 

#OK, we're all done! 

Features command history
tab completion

Zsh

Aliases

Aliases are a nice way to customize your shell. They allow the shell to interpret a command with the exact options that you want without having to type them in all the time. You can also specify a shorter string to execute a longer command. The syntax is alias alias-name=command . If the command contains spaces, you must enclose it within quotes. Here are some examples:

$> alias ll=`ls -l`
$> alias f=`finger`

In the first example, you can get a long directory listing in any given directory by typing   ll . In the second example, you can finger user jones by typing   f jones .

Path To set your path, or other environmental variables, you use a syntax similar to ksh or sh. The syntax is export Variable=Value . Here is an example of adding the bin directory in your home directory to your path.
$> export path=($path $HOME/bin )
.zshrc

The .zshrc file is exected each time you start up a new shell. This would be executed any time you logged onto a machine or statred up an xterm.

.zlogin

The .zlogin file is executed when your start up a new login shell. This occurs when you log onto a computer remotely or when your start an xterm with xterm -ls .

.zshenv The .zshenv , is the usual place to set your environmental variable such as your path. Sample startup files can be found in /usr/local/etc . They will have the same names, only without the leading dot.

Get Help

Questions about this topic? Don't see what you're looking for?

Email engrit-help [at] illinois.edu, call the Help Desk at 217-333-1313, or contact your primary IT support professional.