tcsh ( “tee-see-shell”, “tee-shell”, or as “tee see ess aitch”,
tcsh
) is a
Unix shell
A Unix shell is a Command-line_interface#Command-line_interpreter, command-line interpreter or shell (computing), shell that provides a command line user interface for Unix-like operating systems. The shell is both an interactive command languag ...
based on and
backward compatible
In telecommunications and computing, backward compatibility (or backwards compatibility) is a property of an operating system, software, real-world product, or technology that allows for interoperability with an older legacy system, or with inpu ...
with the
C shell
The C shell (csh or the improved version, tcsh) is a Unix shell created by Bill Joy while he was a graduate student at University of California, Berkeley in the late 1970s. It has been widely distributed, beginning with the 2BSD release of the ...
(
csh
).
Shell
It is essentially the C shell with programmable
command-line completion
Command-line completion (also tab completion) is a common feature of command-line interpreters, in which the program automatically fills in partially typed commands.
Command line interpreters are programs that allow a user to interact with the ...
,
command-line
A command-line interface (CLI) is a means of interacting with software via commands each formatted as a line of text. Command-line interfaces emerged in the mid-1960s, on computer terminals, as an interactive and more user-friendly alternativ ...
editing, and a few other features. Unlike the other common shells,
functions cannot be defined in a tcsh script and the user must use aliases instead (as in csh). It is the native root shell for some BSD-based systems, including
FreeBSD
FreeBSD is a free-software Unix-like operating system descended from the Berkeley Software Distribution (BSD). The first version was released in 1993 developed from 386BSD, one of the first fully functional and free Unix clones on affordable ...
13 and earlier. (FreeBSD 14 changed the default root shell to
sh
to match the default user shell whereas
OpenBSD
OpenBSD is a security-focused operating system, security-focused, free software, Unix-like operating system based on the Berkeley Software Distribution (BSD). Theo de Raadt created OpenBSD in 1995 by fork (software development), forking NetBSD ...
uses the
Korn shell
KornShell (ksh) is a Unix shell which was developed by David Korn at Bell Labs in the early 1980s and announced at USENIX on July 14, 1983. The initial development was based on Bourne shell source code. Other early contributors were Bell ...
ksh
for both root and regular users.)
tcsh added filename and command completion and command line editing concepts borrowed from the
TENEX operating system, which is the source of the “t”.
[
] Because it only added functionality and did not change what was there, tcsh remained
backward compatible
In telecommunications and computing, backward compatibility (or backwards compatibility) is a property of an operating system, software, real-world product, or technology that allows for interoperability with an older legacy system, or with inpu ...
with the original C shell. Though it started as a side branch from the original csh source tree that
Bill Joy
William Nelson Joy (born November 8, 1954) is an American computer engineer and venture capitalist. He co-founded Sun Microsystems in 1982 along with Scott McNealy, Vinod Khosla, and Andy Bechtolsheim, and served as Chief Scientist and CTO ...
had created, tcsh is now the main branch for ongoing development.
tcsh is very stable but new releases continue to appear roughly once a year, consisting mostly of minor bug fixes.
On many systems, such as
macOS
macOS, previously OS X and originally Mac OS X, is a Unix, Unix-based operating system developed and marketed by Apple Inc., Apple since 2001. It is the current operating system for Apple's Mac (computer), Mac computers. With ...
and
Red Hat Linux
Red Hat Linux was a widely used commercial open-source Linux distribution created by Red Hat until its discontinuation in 2004.
Early releases of Red Hat Linux were called Red Hat Commercial Linux. Red Hat published the first non-beta release ...
,
csh
is actually
tcsh
. Often one of the two files is either a
hard link
In computing, a hard link is a directory entry (in a Directory (computing), directory-based file system) that associates a name with a Computer file, file. Thus, each file must have at least one hard link. Creating additional hard links for a fil ...
or a
symbolic link
In computing, a symbolic link (also symlink or soft link) is a file whose purpose is to point to a file or directory (called the "target") by specifying a path thereto.
Symbolic links are supported by POSIX and by most Unix-like operating syste ...
to the other, so that either name refers to the same improved version of the C shell (although behavior may be altered depending on which name is used).
On
Debian
Debian () is a free and open-source software, free and open source Linux distribution, developed by the Debian Project, which was established by Ian Murdock in August 1993. Debian is one of the oldest operating systems based on the Linux kerne ...
and some derivatives (including
Ubuntu
Ubuntu ( ) is a Linux distribution based on Debian and composed primarily of free and open-source software. Developed by the British company Canonical (company), Canonical and a community of contributors under a Meritocracy, meritocratic gover ...
), there are two different packages: csh and tcsh. The former is based on the original BSD version of csh and the latter is the improved tcsh.
History
The “t” in
tcsh
comes from the “T” in
TENEX, an
operating system
An operating system (OS) is system software that manages computer hardware and software resources, and provides common daemon (computing), services for computer programs.
Time-sharing operating systems scheduler (computing), schedule tasks for ...
which inspired Ken Greer at
Carnegie Mellon University
Carnegie Mellon University (CMU) is a private research university in Pittsburgh, Pennsylvania, United States. The institution was established in 1900 by Andrew Carnegie as the Carnegie Technical Schools. In 1912, it became the Carnegie Institu ...
, 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.][
]
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 history
Command 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.
Command line history was added to Unix in Bill Joy's C shell of 1978; ...
***!!
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 from 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
*Command line editing
*Auto-completion of file names and variables as well as programmable completion 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 (in lieu of functions).
**\!#
- 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.
**\!:n*
- argument selector for the arguments from the nth to the last; sufficient arguments need not 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" =~ -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 the which
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 became bash as of 10.3, then zsh as of 10.15. (tcsh is still provided, and upgrading the OS does not change the shell of any existing accounts). tcsh was the default root shell of FreeBSD
FreeBSD is a free-software Unix-like operating system descended from the Berkeley Software Distribution (BSD). The first version was released in 1993 developed from 386BSD, one of the first fully functional and free Unix clones on affordable ...
prior to 14.0 (the current shell and default user shell in older versions, is POSIX
The Portable Operating System Interface (POSIX; ) is a family of standards specified by the IEEE Computer Society for maintaining compatibility between operating systems. POSIX defines application programming interfaces (APIs), along with comm ...
-based) and its descendants like DragonFly BSD
DragonFly BSD is a free and open-source Unix-like operating system forked from FreeBSD 4.8. Matthew Dillon, an Amiga developer in the late 1980s and early 1990s and FreeBSD developer between 1994 and 2003, began working on DragonFly BSD in ...
and DesktopBSD
DesktopBSD was a Unix-derived, desktop-oriented operating system based on FreeBSD. Its goal was to combine the stability of FreeBSD with the ease of use of K Desktop Environment 3, the default graphical user interface.
History and development ...
.
See also
* Comparison of command shells
This article catalogs comparable aspects of notable operating system shell (computing), shells.
General characteristics
{, class="wikitable sortable sticky-header sort-under" style="width: auto; text-align: center; font-size: smaller;"
, -
...
References
External links
*
tcsh releases
tcsh mailing list
tcsh repository
Archive for the O'Reilly book "Using csh and tcsh"
{{Unix shells
Cross-platform free software
Free software programmed in C
Scripting languages
Software using the BSD license
Text-oriented programming languages
Unix shells