Tcsh

From Leo's Notes
Last edited on 14 June 2020, at 22:17.

An alternative c-shell. It's also the default shell used by old systems at University of Calgary Computer Science.

Configuration[edit | edit source]

The .tcshrc file defines the tcsh configuration. An example file follows:

# User specific aliases and functions

alias rm 'rm -i'
alias cp 'cp -i'
alias mv 'mv -i'

set prompt = "%m:%~ %h# "
set histfile = ~/.tcsh_history
set autolist

bindkey "\e[1~" beginning-of-line # Home
bindkey "\e[7~" beginning-of-line # Home rxvt
bindkey "\e[2~" overwrite-mode    # Ins
bindkey "\e[3~" delete-char       # Delete
bindkey "\e[4~" end-of-line       # End
bindkey "\e[8~" end-of-line       # End rxvt

Issues[edit | edit source]

Tcsh has some annoyances out of the box which is 'fixed' with the changes made to .tcshrc above. Here are what the these changes are:

Auto Completion[edit | edit source]

The tab key will by default not do anything, unless the following line is in your tcshrc file:

set autolist

History Logging[edit | edit source]

Similar to the .bash_history file in bash, you can tell tcsh to log your commands in a file by adding the following to your .tcshrc file:

set histfile = ~/.tcsh_history

Remapping Home,End,Delete Keys in tcsh[edit | edit source]

Add the following to your .tcshrc file:

bindkey "\e[1~" beginning-of-line # Home
bindkey "\e[7~" beginning-of-line # Home rxvt
bindkey "\e[2~" overwrite-mode    # Ins
bindkey "\e[3~" delete-char       # Delete
bindkey "\e[4~" end-of-line       # End
bindkey "\e[8~" end-of-line       # End rxvt