Department of Computing | Imperial College |
Linux files: .cshrc |
This file is executed every time you execute a new shell (i.e. every time you log in or open a new xterm window). It is normally used to configure aliases and environment variables.
The standard lab .cshrc contains the lines:
# before changing read the comments at # start of /usr/local/etc/default.cshrc # set your default printer here setenv PRINTER redshift if ( -f /usr/local/etc/default.cshrc ) then source /usr/local/etc/default.cshrc endif # put your aliases here, e.g. alias pd pushd
Do not modify this file unless you know what you are doing.
The normal permissions for this file are read and write for the owner only, and can be set with the command:
chmod 700 .cshrc
echo $PATHYou can change you current search path by appending your new path to the current path, in this way you do not destroy your current setup. For example to add the directory
~/bin
(i.e. a directory
called bin in your own home directory) to your search path, then include the
following command in your .cshrc:
setenv PATH ~/bin:$PATHYour shell will now execute commands in your ~/bin directory, in preference to other commands on the system.
ls -F
.
alias ls '/bin/ls -F'The next example shows how parameters can be passed into the middle of an alias, in this case to finger a user at doc.ic.ac.uk:
alias f "finger /:\!:1@doc.ic.ac.uk"Aliases are very powerful, and can be used to pass paramaters to multiple commands, for a fuller explanation read the manual pages:
csh
tcsh
bash
The following is an example of only executing a set of commands on a certain machine.
#hostname must be in path. if (`hostname` == "fuji.doc.ic.ac.uk") then #The following commands with be executed on fuji ONLY source /usr/cap/etc/default.env source /usr/cap/etc/casim.env endifThis is an example of how to run a command on an xterm only.
if( $TERM == xterms || $TERM == xterm ) then #Commands here will be executed #ONLY on an xterm. else #Commands here will be executed #ONLY if not on an xterm. endif
© CSG / 2000 / help@doc.ic.ac.uk |