Tcsh
Encyclopedia
tcsh is a Unix shell
based on and compatible
with the C shell
(csh). It is essentially the C shell with programmable command line completion
, command-line editing, and a few other features.
, an operating system
which inspired Ken Greer at Carnegie Mellon University
, the author of tcsh, with its command-completion feature. Greer began working on his code to implement Tenex-style file name completion in September 1975, finally merging it into the C shell in December 1981. Mike Ellis at Fairchild A.I. Labs added command completion in September 1983. On October 3, 1983, Greer posted source to the net.sources newsgroup.
Paul Placeway from The Ohio State University
continued work on it in the 1980s, and since then it has been maintained by numerous people. Wilfredo Sanchez, the former lead engineer of Mac OS X
, worked on tcsh in the early 1990s at MIT
.
(the default user shell is POSIX-based) and its descendants like DragonFly BSD
and DesktopBSD
.
Unix shell
A Unix shell is a command-line interpreter or shell that provides a traditional user interface for the Unix operating system and for Unix-like systems...
based on and compatible
Backward compatibility
In the context of telecommunications and computing, a device or technology is said to be backward or downward compatible if it can work with input generated by an older device...
with the C shell
C shell
The C shell is a Unix shell that was created by Bill Joy while a graduate student at University of California, Berkeley in the late 1970s. It has been distributed widely, beginning with the 2BSD release of the BSD Unix system that Joy began distributing in 1978...
(csh). It is essentially the C shell with programmable command line completion
Command line completion
Command line completion is a common feature of command line interpreters, in which the program automatically fills in partially typed commands....
, command-line editing, and a few other features.
History
The "t" in tcsh comes from the T in TENEXTOPS-20
The TOPS-20 operating system by Digital Equipment Corporation was the second proprietary OS for the PDP-10 mainframe computer. TOPS-20 began in 1969 as the TENEX operating system of Bolt, Beranek and Newman...
, an operating system
Operating system
An operating system is a set of programs that manage computer hardware resources and provide common services for application software. The operating system is the most important type of system software in a computer system...
which inspired Ken Greer at Carnegie Mellon University
Carnegie Mellon University
Carnegie Mellon University is a private research university in Pittsburgh, Pennsylvania, United States....
, the author of tcsh, with its command-completion feature. Greer began working on his code to implement Tenex-style file name completion in September 1975, finally merging it into the C shell in December 1981. Mike Ellis at Fairchild A.I. Labs added command completion in September 1983. On October 3, 1983, Greer posted source to the net.sources newsgroup.
Paul Placeway from The Ohio State University
Ohio State University
The Ohio State University, commonly referred to as Ohio State, is a public research university located in Columbus, Ohio. It was originally founded in 1870 as a land-grant university and is currently the third largest university campus in the United States...
continued work on it in the 1980s, and since then it has been maintained by numerous people. Wilfredo Sanchez, the former lead engineer of Mac OS X
Mac OS X
Mac OS X is a series of Unix-based operating systems and graphical user interfaces developed, marketed, and sold by Apple Inc. Since 2002, has been included with all new Macintosh computer systems...
, worked on tcsh in the early 1990s at MIT
Massachusetts Institute of Technology
The Massachusetts Institute of Technology is a private research university located in Cambridge, Massachusetts. MIT has five schools and one college, containing a total of 32 academic departments, with a strong emphasis on scientific and technological education and research.Founded in 1861 in...
.
Significant features
- Command history
- The built-in
history
command displays the previously-entered commands - Use of / at the command line to allow the user to select a command from the history to edit/execute
- Invoking previous commands using command historyCommand HistoryCommand history is a feature in many operating system shells, computer algebra programs, and other software that allows the user to recall, edit and rerun previous commands....
!!
executes the previous command!n
executes the nth command that was previously executed!-n
executes the command that was executed n commands ago!string
executes the most recently-executed command that starts with string!?string
executes the most recently-executed command that contains string
- Using history in new commands
!*
- refers to all of the arguments from the previous command!$
- refers to the last argument from the previous command!^
- refers to the first argument form the previous command!:n
- refers to the nth argument from the previous command!:m-n
- refers to the mth through nth arguments from the previous command!:n-$
- refers to the nth through the last argument from the previous command
- The built-in
- Command line editing
- Auto-completion of file names and variables at the command line
- Alias argument selectors; the ability to define an alias to take arguments supplied to it and apply them to the commands that it refers to. Tcsh is the only shell that provides this feature.
\!#
- argument selector for all arguments, including the alias/command itself; arguments need not be supplied.\!*
- argument selector for all arguments, excluding the alias/command; arguments need not be supplied.\!$
- argument selector for the last argument; argument need not be supplied, but if none is supplied, the alias name is considered to be the last argument.\!^
- argument selector for first argument; argument MUST be supplied.\!:n
- argument selector for the nth argument; argument MUST be supplied; n=0 refers to the alias/command name.\!:m-n
- argument selector for the arguments from the mth to the nth; arguments MUST be supplied.\!:n-$
- argument selector for the arguments from the nth to the last; at least argument n MUST be supplied.
- Alias the cd command so that when you change directories, the contents are immediately displayed.
alias cd 'cd \!* && ls'
- Wildcard matching
if ( "$input" =~ [0-9]* ) then
echo "the input starts with an integer"
else
echo "the input does NOT start with an integer"
endif
- Job control
- The built-in
where
command. Works like thewhich
command but shows all locations of the target command in the directories specified in$PATH
rather than only the one that will be used.
Deployment
Early versions of Mac OS X shipped with tcsh as the default shell, but the default for new accounts is bash as of 10.3. (tcsh is still provided, and upgrading the OS does not change the shell of any existing accounts). The tcsh is the default root shell of FreeBSDFreeBSD
FreeBSD is a free Unix-like operating system descended from AT&T UNIX via BSD UNIX. Although for legal reasons FreeBSD cannot be called “UNIX”, as the direct descendant of BSD UNIX , FreeBSD’s internals and system APIs are UNIX-compliant...
(the default user shell is POSIX-based) and its descendants like DragonFly BSD
DragonFly BSD
DragonFly BSD is a free Unix-like operating system created as a fork of FreeBSD 4.8. Matthew Dillon, an Amiga developer in the late 1980s and early 1990s and a FreeBSD developer between 1994 and 2003, began work on DragonFly BSD in June 2003 and announced it on the FreeBSD mailing lists on July...
and DesktopBSD
DesktopBSD
DesktopBSD is a Unix-derivative, desktop-oriented operating system based on FreeBSD. Its goal is to combine the stability of FreeBSD with the ease-of-use of KDE, which is the default graphical user interface.- History and development :...
.