With the tcsh shell in place, a .tcshrc configuration script allows a user to use the more advanced features of tcsh. I have included a copy of my .tcshrc file here (most of it, at least). To create a new one from scratch, open a text editor such as emacs. But first, make sure you are in your home directory. Type:
$ cd ~
$ emacs .tcshrc &
Copy/Paste
information from the
following into
your emacs
file:
$ emacs .tcshrc &
#
.tcshrc
set path=(~/ /bin /etc /sbin /usr/bin /usr/etc /usr/include /usr/libexec
/usr/sbin /usr /X11R6/bin /usr/bin/X11 /usr/kerberos/bin /usr/local/bin
/usr/local/etc /usr/local/include /usr/local/libexec /usr/local/sbin
/usr/local/share /usr/share/emacs/site-lisp /usr/local/rsi/idl/bin .)
# Append current java version to path
set J2RE_HOME=/opt/jre1.6.0
set path=($J2RE_HOME/bin $path)
set filec # Set file completion of tcsh
set notify # Immediate notification of job comp.
set autolist = ambiguous # Choices listed when tab comp. fails
set fignore=(.a .aux .old .out .dlog) # Ignore these in file completion
set history = 50 # History remembers past 50 cmds
set host = `/bin/hostname` # Set hostname
set shost = `/bin/hostname -s` # Set short hostname
set mail = /var/spool/mail/$USER # Define user mail directory
set prompt = "%S%m:%s %~> " # Reverse prompt w/ host + working dir
unset autologout # Don't allow autologouts
unset savehist # Doesn't save hist. on logout
umask 022 # Set default file permissions
limit coredumpsize 0 # Avoid coredump information
#General setup
setenv HOSTNAME $HOST
setenv SHOSTNAME $shost
setenv TERM linux
setenv EDITOR emacs
setenv MAIL $mail
setenv PRINTER [printername]
setenv MANPATH /usr/bin/man:/usr/kerberos/man:/usr/local/man:/usr/share/man:
/usr/X11R6/man:/usr/man
# LaTeX and IDL configuration
setenv TEXINPUTS .:~/lib/tex:~/lib/tex/prosper
setenv IDL_STARTUP ~/lib/idl/startup.pro
setenv IDL_PATH ~/lib/idl:/usr/local/rsi/idl/lib:/usr/local/rsi/idl/lib/macros:
/usr/local/rsi/idl/lib/utilities
setenv IDL_DIR /usr/local/rsi/idl
setenv LM_LICENSE_FILE /usr/local/rsi/license/license.dat
setenv LD_LIBRARY_PATH /usr/local/lib
# User specific aliases and functions
alias a 'alias'
alias cp 'cp -i'
alias mv 'mv -i'
alias ls 'ls --color=force'
alias ll 'ls -l --color=force'
alias l. 'ls -d .[a-zA-Z]* --color=force'
alias la 'ls -a --color=force'
alias which 'alias | /usr/bin/which --read-alias --show-dot --show-tilde'
alias psm 'ps aux | m'
alias psa 'ps -a'
alias cleanup 'rm -f core *~ *.*~ .*~ *.dlog #*# *.blg'
alias veryclean 'cleanup; rm -f *.o *.log *.dlog *.aux *.bbl *.lof'
alias dir 'ls -l \!* | more'
alias help 'man -k'
alias m 'more'
alias cls 'clear'
alias path 'echo $path'
alias cd.. 'cd ..'
alias f 'finger \!* | more'
alias dvilpr 'dvi2ps \!* | lpr'
alias h 'history'
alias type 'more'
alias psgrep 'ps -a | grep'
alias cdl 'cd; clear'
alias em 'emacs -bg navy -fg white -cr white'
alias xdvi 'xdvi -s 8 -hush -paper us -bg navy -fg white'
alias xload 'xload -bg navy -fg white'
alias lpr 'lpr -s -h'
alias ssh 'ssh -l[username]'
# Host aliases
alias [SHOSTNAME #1] 'ssh -l[username] [HOST #1]'
# INSERT : toggles overwrite or insert mode.
bindkey ^[[2~ overwrite-mode
# DELETE : delete char at cursor position.
bindkey ^[[3~ delete-char
# PAGE UP : search in history backwards for line beginning as current.
bindkey ^[[5~ history-search-backward
# PAGE DOWN : search in history forwards for line beginning as current.
bindkey ^[[6~ history-search-forward
# ESC-left-arrow : go to beginning of left word.
bindkey ^[^[[D vi-word-back
# ESC-right-arrow : go to beginning of right word.
bindkey ^[^[[C vi-word-fwd
Anywhere
you see "[]",
put in
your own user-specific information, except for the alias corresponding
to "alias l. 'ls -d .[a-zA-Z]*
--color=force'" (which is an extremely useful alias
when trying to list dot files such as .tcshrc). Also note that the "set path", "setenv MANPATH", and "setenv IDL_PATH"
options should all span a single line (you may have to do some
editing). Hit ^x-s
to save
(Ctrl-x, keep holding down Ctrl, Ctrl-s) and ^x-c to
exit. Some of the
information
may not be applicable to you, such as the LaTeX or IDL stuff, so
pick and choose
as you like. With
respect to "Host
aliases", I like to be able to log into a host quickly
using a
short hostname. Hence the alias. The last lines fix
the
"Insert" and "Delete" keys (and so on) so that they actually work properly in FC6.
Once
changes are made to your .tcshrc
file, you must source
it, which will read and execute all of the commands just created
into your tcsh
shell
environment. Type:
set path=(~/ /bin /etc /sbin /usr/bin /usr/etc /usr/include /usr/libexec
/usr/sbin /usr /X11R6/bin /usr/bin/X11 /usr/kerberos/bin /usr/local/bin
/usr/local/etc /usr/local/include /usr/local/libexec /usr/local/sbin
/usr/local/share /usr/share/emacs/site-lisp /usr/local/rsi/idl/bin .)
# Append current java version to path
set J2RE_HOME=/opt/jre1.6.0
set path=($J2RE_HOME/bin $path)
set filec # Set file completion of tcsh
set notify # Immediate notification of job comp.
set autolist = ambiguous # Choices listed when tab comp. fails
set fignore=(.a .aux .old .out .dlog) # Ignore these in file completion
set history = 50 # History remembers past 50 cmds
set host = `/bin/hostname` # Set hostname
set shost = `/bin/hostname -s` # Set short hostname
set mail = /var/spool/mail/$USER # Define user mail directory
set prompt = "%S%m:%s %~> " # Reverse prompt w/ host + working dir
unset autologout # Don't allow autologouts
unset savehist # Doesn't save hist. on logout
umask 022 # Set default file permissions
limit coredumpsize 0 # Avoid coredump information
#General setup
setenv HOSTNAME $HOST
setenv SHOSTNAME $shost
setenv TERM linux
setenv EDITOR emacs
setenv MAIL $mail
setenv PRINTER [printername]
setenv MANPATH /usr/bin/man:/usr/kerberos/man:/usr/local/man:/usr/share/man:
/usr/X11R6/man:/usr/man
# LaTeX and IDL configuration
setenv TEXINPUTS .:~/lib/tex:~/lib/tex/prosper
setenv IDL_STARTUP ~/lib/idl/startup.pro
setenv IDL_PATH ~/lib/idl:/usr/local/rsi/idl/lib:/usr/local/rsi/idl/lib/macros:
/usr/local/rsi/idl/lib/utilities
setenv IDL_DIR /usr/local/rsi/idl
setenv LM_LICENSE_FILE /usr/local/rsi/license/license.dat
setenv LD_LIBRARY_PATH /usr/local/lib
# User specific aliases and functions
alias a 'alias'
alias cp 'cp -i'
alias mv 'mv -i'
alias ls 'ls --color=force'
alias ll 'ls -l --color=force'
alias l. 'ls -d .[a-zA-Z]* --color=force'
alias la 'ls -a --color=force'
alias which 'alias | /usr/bin/which --read-alias --show-dot --show-tilde'
alias psm 'ps aux | m'
alias psa 'ps -a'
alias cleanup 'rm -f core *~ *.*~ .*~ *.dlog #*# *.blg'
alias veryclean 'cleanup; rm -f *.o *.log *.dlog *.aux *.bbl *.lof'
alias dir 'ls -l \!* | more'
alias help 'man -k'
alias m 'more'
alias cls 'clear'
alias path 'echo $path'
alias cd.. 'cd ..'
alias f 'finger \!* | more'
alias dvilpr 'dvi2ps \!* | lpr'
alias h 'history'
alias type 'more'
alias psgrep 'ps -a | grep'
alias cdl 'cd; clear'
alias em 'emacs -bg navy -fg white -cr white'
alias xdvi 'xdvi -s 8 -hush -paper us -bg navy -fg white'
alias xload 'xload -bg navy -fg white'
alias lpr 'lpr -s -h'
alias ssh 'ssh -l[username]'
# Host aliases
alias [SHOSTNAME #1] 'ssh -l[username] [HOST #1]'
# INSERT : toggles overwrite or insert mode.
bindkey ^[[2~ overwrite-mode
# DELETE : delete char at cursor position.
bindkey ^[[3~ delete-char
# PAGE UP : search in history backwards for line beginning as current.
bindkey ^[[5~ history-search-backward
# PAGE DOWN : search in history forwards for line beginning as current.
bindkey ^[[6~ history-search-forward
# ESC-left-arrow : go to beginning of left word.
bindkey ^[^[[D vi-word-back
# ESC-right-arrow : go to beginning of right word.
bindkey ^[^[[C vi-word-fwd
$
source
~/.tcshrc
Notice
that your prompt just changed due
to the "set prompt"
command. From now on, whenever you launch a new terminal,
your .tcshrc
file will
automatically be source'd. For more information on configuring tcsh to your
liking, see tcshrc.sourceforge.net/
and www.kitebird.com/csh-tcsh-book/.

