->Title Page
->Intro
->Unix
-->Overview
-->File Structure
-->Online Manual
-->Basic Commands
-->Additional Commands
-->Login files
->.cshrc file
--->.login
-->Special characters
-->Miscellaneous Tips
-->Things to try
->Vi editor
->Mirror sites
->Further reading

[ Up ]
[Prev][Home][Next]
[Author]

Unix --> The .cshrc file

The following is an example .cshrc file. The "#" character at the beginning of a line tells the C shell to ignore the rest of the line. I don't expect you to understand every command in this file or in the example .login file found in the next section, but I don't care to explain them all either. This document is getting too long as it is.


###########################################################
#                                                         #
#         Example .cshrc file                             #
#                                                         #
#         by Chris Taylor                                 #
#                                                         #
###########################################################

# Set path shell variable
# (See description of path in the
#  paragraph followin this example .cshrc)
set path = ( /usr/bin /usr/local /usr/local/bin \
             /usr/bin/X11 /usr/ucb /usr/opt/bin ~ )

# Don't overwrite existing files with the redirection
# character ">"
set noclobber

# Don't create core dump files when a program blows up.
limit coredumpsize 0

# Check to see if this is an interactive shell.
# If not, skip the rest of this file.
if ($?USER == 0 || $?prompt == 0) exit

## Set C shell variables
# Remember my 40 most recent events
set history=40

# Save the most recent 40 events when I log out
set savehist=40

# Substitute the filename to be completed when I type an
# <ESC> at the command line
set filec

# Tells the shell to ignore .o files when trying to
# complete filenames when filec is set.  (This doesn't
# hold if the .o file is the only  on that could be
# completed.
set fignore=.o

# Tells "filec" not to cry if it can't complete a file.
set nobeep

# Notify me when the status of background jobs change
set notify

# Don't let me log out by pressing <ctrl-d>
set ignoreeof

# Set TTY shell variable equal to the current terminal name
set TTY=`who am i | awk '{print $2}'`

# Allow others to send messages directly to my terminal
mesg y


# Set prompt to have the following form: [cmd#]cpu[directory]:
set cpu=`hostname | awk '{FS = "."; print $1}'` # cpu = computer name
alias sp   set prompt='\[!\]$cpu\[$cwd\]:\ ' # set sp to set the prompt
alias cd   'chdir \!* ; sp'                  # redefine cd command
alias pd   'pushd \!* ; sp'                  # redefine pd command
alias pp   'popd \!* ; sp'                   # redefine pp command
sp                                           # set the prompt

# Shortcut aliases
alias c       'clear'
alias dict    'vi /usr/dict/words'
alias gv      'ghostview'
alias h       'history !* | head -39 | more'
alias laser   'lpr -Pmsa13 -h'
alias line    'lpr -Ped3'
alias ll      'ls -la'
alias ls      'ls -x'
alias mine    'chmod og-rwx'
alias pwd     'echo $cwd'       # Faster than pwd
alias safe    'chmod a-w'
alias tmp     'cd /tmp/taylor'

# end of .cshrc file
A number of commands, i.e. history, set, etc... are built in commands. The rest of the commands must call an external program to execute it. Not all of these other commands are stored in the same directory. They are spread into a bunch of different directories. The path variable is a shell variable that tells the shell where to look for these commands. In the example .cshrc file, the path variable is set to


( /usr/bin /usr/local /usr/local/bin /usr/bin/X11 /usr/ucb /usr/opt/bin ~ )
This tells the shell to look first in the /usr/bin directory, then in the /usr/local directory, next in the /usr/local/bin directory, and so on until the file has been found or all directories have been looked at.

Please notify owners of webpages with outdated links to these pages

Find this site useful? Want to give something back?

© 1993-2001 Christopher C. Taylor