Showing posts with label csh. Show all posts
Showing posts with label csh. Show all posts

Friday, September 8, 2017

How to install tcsh or csh shell on a Debian or Ubuntu Linux ?

Cshell is a shell (command interpreter) with C-like syntax.

csh is a command language interpreter incorporating a history mechanism , job control facilities , interactive file name and user name completion, and a C-like syntax. It is used both as an interactive login shell and a shell script command processor. tcsh is an enhanced but completely compatible version of the Berkeley UNIX C shell.

"tcsh" advantages

   - The ability to use multiline aliases and exec statements in a reliable and consistent way.                          (Hense "sh" scripts can be  re-written as tcsh scripts with aliases instead of functions.)
   - "tcsh" is the same on all machines.  For "csh" I typically  have to modify scripts for different machines.  [example: HP-UX  "set nonomatch" needs to be replaced by "set nonomatch = ()"] 
   - source code is freely available
   - PWD and other common environmental variables are always defined. With "csh" this depends on the machine.

In most cases csh / tcsh is installed by default. All you have to do is type shell name to start using it:

$ csh

$ tcsh

Install csh / tcsh

In case csh is not installed, type the following command at shell prompt as per your Linux distro / version.

Install it on Debian/Ubuntu/Mint Linux

$ sudo apt-get install csh

Install it on CentOS/RHEL

# yum install tcsh

Install it on Fedora Linux

$ sudo dnf install tcsh
Set csh as default login shell
To make csh as default login shell, type the following command:
$ which tcsh
$ which csh
Sample output:
Note down the /bin/csh or /bin/tcsh path. To change the shell simply type
$ chsh
$ chsh -s /bin/csh