Tcsh Explained

TENEX C Shell
Screenshot Size:250px
Developer:Ken Greer, Paul Placeway, Christos Zoulas, et al.
Programming Language:C
Operating System:Cross-platform
Genre:Unix shell
License:2002: BSD-3-Clause[1] [2]
1991: BSD-4-Clause[3]

tcsh (“tee-see-shell”, “tee-shell”, or as “tee see ess aitch”, tcsh) is a Unix shell based on and backward compatible with the C shell (csh).

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 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[4] whereas OpenBSD uses the Korn shell ksh for both root and regular users.[5])

tcsh added filename and command completion and command line editing concepts borrowed from the TENEX operating system, which is the source of the “t”.[6] Because it only added functionality and did not change what was there, tcsh remained backward compatible[7] 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.[8]

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[9] [10] and the latter is the improved tcsh.[11] [12]

History

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.[13] 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.[6] Mike Ellis at Fairchild A.I. Labs added command completion in September 1983.[6] On October 3, 1983, Greer posted source to the net.sources newsgroup.[6]

Significant features

  1. 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

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 prior to 14.0 (the current shell and default user shell in older versions, is POSIX-based)[14] [15] [16] and its descendants like DragonFly BSD and DesktopBSD.

See also

External links

Notes and References

  1. Web site: remove clause 3 of the copyright.. . 2002-03-08.
  2. Web site: Remove clause 3 of the copyright (changed in other files 2002-03-08).. . 2014-07-14.
  3. Web site: Tcsh-6.00 release. . 1991-07-04.
  4. Web site: FreeBSD Quickstart Guide for Linux Users .
  5. Web site: OpenBSD for Linux Users .
  6. Ken Greer. C shell with command and filename recognition/completion. 3 Oct 1983. net.sources. 29 December 2010.
  7. https://web.archive.org/web/20060117151444/http://www.tcsh.org/tcsh.html/DESCRIPTION.html tcsh(1) man page
  8. Fixes file in tcsh-17 June 2000.
  9. http://packages.ubuntu.com/csh Ubuntu - Details of package csh
  10. https://tracker.debian.org/pkg/csh Debian - Details of package csh
  11. http://packages.ubuntu.com/tcsh Ubuntu - Details of package tcsh
  12. https://tracker.debian.org/pkg/tcsh Debian - Details of package tcsh
  13. Web site: The T in tcsh . https://web.archive.org/web/20120414085306/http://www.tcsh.org/tcsh.html/THE_T_IN_TCSH.html . 14 April 2012 . dead . 31 October 2013.
  14. Book: Michael Urban. Brian Tiemann. Sams teach yourself FreeBSD in 24 hours. 2002. Sams Publishing. 978-0-672-32424-6. 56.
  15. http://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xcu_chap02.html POSIX 2008 Shell Command Language
  16. Web site: FreeBSD Quickstart Guide for Linux Users . 2024-02-04 . FreeBSD Documentation Portal . en.