TcShell

From Remeis-Wiki
Jump to navigation Jump to search


The interface between the unix system and the user is called (unix-)shell. There are in principle many types of shells available. They differ in built-in commands and scripting syntax (e.g. for-loops). However, the commands for basic file operations (cd, cp, rm, ...) are in principle identical and running other programs is done by executing the binary file via ./binaryfile. If the binary is located in one of the directories specified in the PATH variable, the program can be executed from every where in the file system without the leading ./

Nearly all unix distributions (Ubuntu, SuSe, ...) are using a different default shell. The default shell on the Remeis computers is the TC-shell, which is based on the C-shell. If you want to know on which shell you are operating right now, type

 echo $SHELL

in, which should result in /bin/tcsh.

Configuration

Each user can change the default behavior of the TC-shell via the configuration file ~/.cshrc
This file gets executed each time a new TC-shell is started. Thus changes are applied only after a new shell is opened! The default configuration file looks like

 #!/bin/tcsh -f
 
 set prompt="%n@%m:%~> "
 set nobeep = 1
 set matchbeep = never
 alias l 'ls -l --color=auto'
 alias ls 'ls --color=auto'
 
 # setenv EDITOR jed
 
 if(-d $HOME/bin)  setenv PATH $HOME/bin:$PATH
 
 # LaTeX
 # setenv TEXINPUTS .:~/share/latex::
 # setenv BIBINPUTS .:~/share/bibtex::
 # setenv BSTINPUTS .:~/share/bibtex/bibstyles::
 
 # Astro software
 source /data/system/software/softwarescript.csh
 source $SOFTDIR/softwarescript_Xray.csh

The first line tells the system on which shell the script should be executed. This can be set by

 #!path_to_shell_binary some_options

Of course, the shell here is the TC-shell, located in /bin/tcsh.

Prompt

The following block defines some specific variables: prompt defines how your prompt (the information on the left of the command line) should look like. The available place holders are defined as follows:

%\ current directory
%~ current directory with user's home as ~
%n username
%m hostname

For the default value this results, e.g, in

 username@remeiscomputer:~>

You can also add the output of other commands to the prompt using `command` in the definition. The value "%n@%m:%\> " is equal to

 "`whoami`@`hostname -s`:`pwd`> "

Default Editor

The (commented) line

 # setenv EDITOR jed

defines the default editor which is executed if the command $EDITOR is entered. This is important for editors of git-repositories, because git commit calls the in $EDITOR defined command such that the user can enter a comment describing the changes. If this variable is not set or commented, the default editor would be joe or vim. They are very fast editors, but not user-friendly. To uncommment the line just remove the # at the beginning of the line.