Loading AI tools
Unix shell based on and compatible with the C shell From Wikipedia, the free encyclopedia
tcsh (/ˌtiːˈsiːʃɛl/ “tee-see-shell”, /ˈtiːʃɛl/ “tee-shell”, or as “tee see ess aitch”, tcsh
) is a Unix shell based on and backward compatible with the C shell (csh
).
Developer(s) | Ken Greer, Paul Placeway, Christos Zoulas, et al. |
---|---|
Stable release | |
Repository | |
Written in | C |
Operating system | Cross-platform |
Type | Unix shell |
License | 2002: BSD-3-Clause[2][3] 1991: BSD-4-Clause[4] |
Website | www |
It is essentially the C shell with programmable command-line completion, command-line 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 13 and earlier. (FreeBSD 14 changed the default root shell to sh
to match the default user shell[5] whereas OpenBSD uses the Korn shell ksh
for both root and regular users.[6])
tcsh added filename and command completion and command line editing concepts borrowed from the TENEX operating system, which is the source of the “t”.[7] Because it only added functionality and did not change what was there, tcsh remained backward compatible[8] with the original C shell. Though it started as a side branch from the original csh source tree that Bill Joy 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.[9]
On many systems, such as macOS and Red Hat Linux, csh
is actually tcsh
. Often one of the two files is either a hard link or a symbolic link 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 and some derivatives (including Ubuntu), there are two different packages: csh
and tcsh
. The former is based on the original BSD version of csh[10][11] and the latter is the improved tcsh.[12][13]
The “t” in tcsh
comes from the “T” in TENEX, an operating system which inspired Ken Greer at Carnegie Mellon University, the author of tcsh, with its command-completion feature.[14] 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.[7] Mike Ellis at Fairchild A.I. Labs added command completion in September 1983.[7] On October 3, 1983, Greer posted source to the net.sources newsgroup.[7]
history
command displays the previously entered 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!*
- 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\!#
- 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'
if ( "$input" =~ [0-9]* ) then
echo "the input starts with an integer"
else
echo "the input does NOT start with an integer"
endif
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.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 prior to 14.0 (the current shell and default user shell in older versions, is POSIX-based)[15][16][17] and its descendants like DragonFly BSD and DesktopBSD.
Seamless Wikipedia browsing. On steroids.
Every time you click a link to Wikipedia, Wiktionary or Wikiquote in your browser's search results, it will show the modern Wikiwand interface.
Wikiwand extension is a five stars, simple, with minimum permission required to keep your browsing private, safe and transparent.