Tcsh: Difference between revisions

From Leo's Notes
This page was last edited on 14 June 2020, at 22:17.
mNo edit summary
mNo edit summary
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
An alternative c-shell
An alternative c-shell. It's also the default shell used by old systems at University of Calgary Computer Science.


== Configuration ==
== Configuration ==
The {{code|.tcshrc}} file defines the tcsh configuration. An example file follows:


The .tcshrc file defines the tcsh configuration. An example file follows:
{{highlight|lang=text|code=
# User specific aliases and functions


# .tcshrc
alias rm 'rm -i'
alias cp 'cp -i'
# User specific aliases and functions
alias mv 'mv -i'
 
alias rm 'rm -i'
set prompt = "%m:%~ %h# "
alias cp 'cp -i'
set histfile = ~/.tcsh_history
alias mv 'mv -i'
set autolist
 
set prompt = "%m:%~ %h# "
bindkey "\e[1~" beginning-of-line # Home
set histfile = ~/.tcsh_history
bindkey "\e[7~" beginning-of-line # Home rxvt
set autolist
bindkey "\e[2~" overwrite-mode    # Ins
bindkey "\e[3~" delete-char      # Delete
bindkey "\e[1~" beginning-of-line # Home
bindkey "\e[4~" end-of-line      # End
bindkey "\e[7~" beginning-of-line # Home rxvt
bindkey "\e[8~" end-of-line      # End 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 ==
== Issues ==
The following things are covered by the example file above, but are covered in a little more detail.
Tcsh has some annoyances out of the box which is 'fixed' with the changes made to {{code|.tcshrc}} above. Here are what the these changes are:


=== Auto Completion ===
=== Auto Completion ===
The tab key will by default not do anything, unless the following line is in your tcshrc file:
The tab key will by default not do anything, unless the following line is in your tcshrc file:
set autolist
{{highlight|lang=text|code=
set autolist
}}


=== History Logging ===
=== History Logging ===
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:
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
{{highlight|lang=text|code=
set histfile = ~/.tcsh_history
}}


=== Remapping Home,End,Delete Keys in tcsh ===
=== Remapping Home,End,Delete Keys in tcsh ===
Add the following to your tcshrc file:
Add the following to your .tcshrc file:
   
   
bindkey "\e[1~" beginning-of-line # Home
{{highlight|lang=text|code=
bindkey "\e[7~" beginning-of-line # Home rxvt
bindkey "\e[1~" beginning-of-line # Home
bindkey "\e[2~" overwrite-mode    # Ins
bindkey "\e[7~" beginning-of-line # Home rxvt
bindkey "\e[3~" delete-char      # Delete
bindkey "\e[2~" overwrite-mode    # Ins
bindkey "\e[4~" end-of-line      # End
bindkey "\e[3~" delete-char      # Delete
bindkey "\e[8~" end-of-line      # End rxvt
bindkey "\e[4~" end-of-line      # End
 
bindkey "\e[8~" end-of-line      # End rxvt
 
}}


[[Category:Linux]]
{{Navbox Linux}}[[Category:Linux]]
{{Navbox Linux}}
[[Category:LinuxUtilities]]

Latest revision as of 22:17, 14 June 2020

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

Configuration

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

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

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

set autolist

History Logging

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

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