Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Tcsh
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{short description|Unix shell based on and compatible with the C shell}} {{Primary sources|date=April 2024}} {{lowercase title|title=tcsh}} {{Infobox software | name = TENEX C Shell | screenshot = TC Shell.png | screenshot size = 250px | caption = Screenshot of a sample tcsh session | developer = Ken Greer, Paul Placeway, Christos Zoulas, et al. <!-- this may need updating/fixing--> | latest release version = {{wikidata|property|edit|reference|P348}} | latest release date = {{start date and age|{{wikidata|qualifier|P348|P577}}}} | repo = https://cvsweb.netbsd.org/bsdweb.cgi/src/bin/csh/ | programming language = [[C (programming language)|C]] | operating_system = [[Cross-platform]] | genre = [[Unix shell]] | license = 2002: [[BSD licenses|BSD-3-Clause]]<ref>{{cite web|url=https://github.com/tcsh-org/tcsh/commit/7388dded158c85eb207e03671f154d0c49219def|title=remove clause 3 of the copyright.|website=[[GitHub]] |date=2002-03-08}}</ref><ref>{{cite web|url=https://github.com/tcsh-org/tcsh/commit/e6a925ce7379b468074c85acd7874fdd0664a026|title=Remove clause 3 of the copyright (changed in other files 2002-03-08).|website=[[GitHub]] |date=2014-07-14}}</ref><br />1991: [[BSD licenses|BSD-4-Clause]]<ref>{{cite web|url=https://github.com/tcsh-org/tcsh/commit/67db0c9b15096db79f615eeb0f492ec728d7adb2|title=Tcsh-6.00 release|website=[[GitHub]] |date=1991-07-04}}</ref> | website = {{URL|http://www.tcsh.org/}} }} '''tcsh''' ({{IPAc-en|ˌ|t|iː|ˈ|s|iː|ʃ|ɛ|l}} “tee-see-shell”, {{IPAc-en|ˈ|t|iː|ʃ|ɛ|l}} “tee-shell”, or as “tee see ess aitch”, <code>tcsh</code>) is a [[Unix shell]] based on and [[backward compatible]] with the [[C shell]] (<code>csh</code>). ==Shell== 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 (programming)|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 <code>sh</code> to match the default user shell<ref>{{cite web | url=https://docs.freebsd.org/en/articles/linux-users/ | title=FreeBSD Quickstart Guide for Linux Users }}</ref> whereas [[OpenBSD]] uses the [[Korn shell]] <code>ksh</code> for both root and regular users.<ref>{{cite web | url=https://www.openbsdhandbook.com/openbsd_for_linux_users/ | title=OpenBSD for Linux Users }}</ref>) tcsh added filename and command completion and command line editing concepts borrowed from the [[TENEX (operating system)|TENEX]] operating system, which is the source of the “t”.<ref name=Greer> {{Cite newsgroup | author = Ken Greer | title = C shell with command and filename recognition/completion | date = 3 Oct 1983 | newsgroup = net.sources | url = https://groups.google.com/group/net.sources/msg/7073bf41cc5da330?hl=en | access-date = 29 December 2010 }}</ref> Because it only added functionality and did not change what was there, tcsh remained [[backward compatible]]<ref>[https://web.archive.org/web/20060117151444/http://www.tcsh.org/tcsh.html/DESCRIPTION.html tcsh(1) man page]. tcsh.</ref> 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.<ref>Fixes file in tcsh-17 June 2000.</ref> On many systems, such as [[macOS]] and [[Red Hat Linux]], <code>csh</code> is actually <code>tcsh</code>. 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 (operating system)|Ubuntu]]), there are two different packages: csh and tcsh. The former is based on the original BSD version of csh<ref>[https://launchpad.net/ubuntu/+source/csh Ubuntu - Details of package csh]. launchpad.net.</ref><ref>[https://tracker.debian.org/pkg/csh Debian - Details of package csh]. tracker.debian.org.</ref> and the latter is the improved tcsh.<ref>[https://launchpad.net/ubuntu/+source/tcsh Ubuntu - Details of package tcsh]. launchpad.net.</ref><ref>[https://tracker.debian.org/pkg/tcsh Debian - Details of package tcsh]. tracker.debian.org.</ref> ==History== The “t” in <code>tcsh</code> comes from the “T” in [[TENEX (operating system)|TENEX]], an [[operating system]] which inspired Ken Greer at [[Carnegie Mellon University]], the author of tcsh, with its command-completion feature.<ref>{{cite web |url =http://www.tcsh.org/tcsh.html/THE_T_IN_TCSH.html |title =The T in tcsh |archive-url =https://web.archive.org/web/20120414085306/http://www.tcsh.org/tcsh.html/THE_T_IN_TCSH.html |archive-date =14 April 2012 |url-status =dead |access-date =31 October 2013 }}</ref> 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.<ref name=Greer/> Mike Ellis at Fairchild A.I. Labs added command completion in September 1983.<ref name=Greer/> On October 3, 1983, Greer posted source to the net.sources newsgroup.<ref name=Greer/> ==Significant features== *Command history **The built-in <code>history</code> command displays the previously entered commands **Use of {{Keypress|UP}} / {{Keypress|DOWN}} at the command line to allow the user to select a command from the history to edit/execute **Invoking previous commands using [[command history]] ***<code>!!</code> executes the previous command ***<code>!n</code> executes the nth command that was previously executed ***<code>!-n</code> executes the command that was executed ''n'' commands ago ***<code>!''string''</code> executes the most recently executed command that starts with ''string'' ***<code>!?''string''</code> executes the most recently executed command that contains ''string'' **Using history in new commands ***<code>!*</code> - refers to all of the arguments from the previous command ***<code>!$</code> - refers to the last argument from the previous command ***<code>!^</code> - refers to the first argument from the previous command ***<code>!:n</code> - refers to the n<sup>th</sup> argument from the previous command ***<code>!:m-n</code> - refers to the m<sup>th</sup> through n<sup>th</sup> arguments from the previous command ***<code>!:n-$</code> - refers to the n<sup>th</sup> 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). **<code>\!#</code> - argument selector for all arguments, including the alias/command itself; arguments need not be supplied. **<code>\!*</code> - argument selector for all arguments, excluding the alias/command; arguments need not be supplied. **<code>\!$</code> - 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. **<code>\!^</code> - argument selector for first argument; argument MUST be supplied. **<code>\!:n</code> - argument selector for the n<sup>th</sup> argument; argument MUST be supplied; n=0 refers to the alias/command name. **<code>\!:m-n</code> - argument selector for the arguments from the m<sup>th</sup> to the n<sup>th</sup>; arguments MUST be supplied. **<code>\!:n-$</code> - argument selector for the arguments from the n<sup>th</sup> to the last; at least argument n MUST be supplied. **<code>\!:n*</code> - argument selector for the arguments from the n<sup>th</sup> to the last; sufficient arguments need not be supplied.<syntaxhighlight lang="csh"> #Alias the cd command so that when you change directories, the contents are immediately displayed. alias cd 'cd \!* && ls' </syntaxhighlight> *Wildcard matching<syntaxhighlight lang="csh"> if ( "$input" =~ [0-9]* ) then echo "the input starts with an integer" else echo "the input does NOT start with an integer" endif </syntaxhighlight> *Job control *The built-in <code>where</code> command. Works like the <code>which</code> command but shows '''all''' locations of the target command in the directories specified in <code>$PATH</code> 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 (Unix shell)|bash]] as of [[Mac OS X Panther|10.3]], then [[Z shell|zsh]] as of [[macOS Catalina|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)<ref name="UrbanTiemann2002">{{cite book|author1=Michael Urban|author2=Brian Tiemann|title=Sams teach yourself FreeBSD in 24 hours|url=https://books.google.com/books?id=LyDP5b2xzaMC&pg=PA56|year=2002|publisher=Sams Publishing|isbn=978-0-672-32424-6|page=56}}</ref><ref>[http://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xcu_chap02.html POSIX 2008 Shell Command Language] "The System V shell was selected as the starting point for the Shell and Utilities volume of POSIX.1-2008. The BSD C shell was excluded from consideration"</ref><ref>{{Cite web |title=FreeBSD Quickstart Guide for Linux Users |url=https://docs.freebsd.org/en/articles/linux-users/ |access-date=2024-02-04 |website=FreeBSD Documentation Portal |language=en}}</ref> and its descendants like [[DragonFly BSD]] and [[DesktopBSD]]. ==See also== {{Portal|Free and open-source software}} * [[Comparison of command shells]] ==References== {{Reflist}} ==External links== * {{Official website|http://www.tcsh.org}} * [http://ftp.astron.com/pub/tcsh tcsh releases] * [https://mailman.astron.com/mailman/listinfo/tcsh tcsh mailing list] * [https://web.archive.org/web/20051029095645/http://www.tcsh.org/tcsh.html/top.html tcsh manual page] * [https://cvsweb.netbsd.org/bsdweb.cgi/src/bin/csh/ tcsh repository] * [http://www.kitebird.com/csh-tcsh-book/ Archive for the O'Reilly book "Using csh and tcsh"] {{Webarchive|url=https://web.archive.org/web/20110225022338/http://www.kitebird.com/csh-tcsh-book/ |date=2011-02-25 }} {{Unix shells}} [[Category:Cross-platform free software]] [[Category:Free software programmed in C]] [[Category:Scripting languages]] [[Category:Software using the BSD license]] [[Category:Text-oriented programming languages]] [[Category:Unix shells]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Cite book
(
edit
)
Template:Cite newsgroup
(
edit
)
Template:Cite web
(
edit
)
Template:IPAc-en
(
edit
)
Template:Infobox
(
edit
)
Template:Infobox software
(
edit
)
Template:Keypress
(
edit
)
Template:Lowercase title
(
edit
)
Template:Main other
(
edit
)
Template:Official website
(
edit
)
Template:Portal
(
edit
)
Template:Primary sources
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)
Template:Template other
(
edit
)
Template:Unix shells
(
edit
)
Template:Webarchive
(
edit
)