Tcsh

From LQWiki
Jump to: navigation, search

tcsh is an updated version of the C shell, csh. tcsh offers a wider range of control in the interactive shell, with its scripting capabilities are nearly identical to that of csh.

One of the nicest of these features is the ability to interactively edit the command line with either emacs (the default) or vi (activate with bindkey -v) keybindings.

To see the shell's filename completion in action simply start typing the first few letters of a command or filename, and hit the 'Tab' key (or 'Esc' key twice). The ability to report possible completions is possible by setting the "autolist" variable (by set autolist) - which can be added to the shells configuration file (~/.tcshrc).

Shell initialization

tcsh reads several files upon startup. It always reads /etc/csh.cshrc and ~/.tcshrc. Login shells also read /etc/csh.login and ~/.login.

The place to put aliases and simple environment variable settings that you want every time you open a shell is in .tcshrc in your home directory. Example .tcshrc file:

setenv PAGER less
alias md mkdir
alias rd rmdir

Adding a directory to your PATH should not be done in your .tcshrc because it can get run multiple times. It should be in your .login file like this:

setenv PATH ~/bin:$PATH

Unlike bash, there is no need to call the .tcshrc file from the .login file, as tcsh reads the .tcshrc file even in login shells.

External links

This article is a stub and needs to be finished. Plunge forward and help it grow!