Difference between revisions of "TcShell"

From Remeis-Wiki
Jump to navigation Jump to search
Line 2: Line 2:
  
 
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.
 
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.
<tt>for-loops</tt>). However, the commands for basic file operations (<tt>cd, cp, rm, ...</tt>) are in principle identical and running other programs is done by executing the binary file via <tt>./binaryfile</tt>. If the binary is located in one of the directories specified in the <tt>PATH</tt> variable, the program can be executed from every where in the file system without the leading ./
+
<code>for-loops</code>). However, the commands for basic file operations (<code>cd, cp, rm, ...</code>) are in principle identical and running other programs is done by executing the binary file via <code>./binaryfile</code>. If the binary is located in one of the directories specified in the <code>PATH</code> 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
 
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
 
   echo $SHELL
in, which should result in <tt>/bin/tcsh</tt>.
+
in, which should result in <code>/bin/tcsh</code>.
  
 
=== Configuration ===
 
=== Configuration ===
Line 36: Line 36:
 
The first line tells the system on which shell the script should be executed. This can be set by
 
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
 
   #!path_to_shell_binary some_options
Of course, the shell here is the TC-shell, located in <tt>/bin/tcsh</tt>.
+
Of course, the shell here is the TC-shell, located in <code>/bin/tcsh</code>.
  
 
====== Prompt ======
 
====== Prompt ======
  
The following block defines some specific variables: <tt>prompt</tt> defines how your prompt (the information on the left of the command line) should look like. The available place holders are defined as follows:
+
The following block defines some specific variables: <code>prompt</code> defines how your prompt (the information on the left of the command line) should look like. The available place holders are defined as follows:
 
{| class="wikitable"
 
{| class="wikitable"
 
| %\  || current directory   
 
| %\  || current directory   
Line 59: Line 59:
 
The (commented) line
 
The (commented) line
 
   # setenv EDITOR jed
 
   # setenv EDITOR jed
defines the default editor which is executed if the command <tt>$EDITOR</tt> is entered. This is important for editors of [[git:start|git-repositories]], because <code>git commit</code> 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 <tt>joe</tt> or <tt>vim</tt>. They are very fast editors, but not user-friendly. To uncommment the line just remove the # at the beginning of the line.
+
defines the default editor which is executed if the command <code>$EDITOR</code> is entered. This is important for editors of [[git:start|git-repositories]], because <code>git commit</code> 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 <code>joe</code> or <code>vim</code>. They are very fast editors, but not user-friendly. To uncommment the line just remove the # at the beginning of the line.

Revision as of 15:50, 11 April 2018

TC shell

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.