Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

tcsh

From Wikipedia, the free encyclopedia
Unix shell based on and compatible with the C shell
icon
This articlerelies excessively onreferences toprimary sources. Please improve this article by addingsecondary or tertiary sources.
Find sources: "Tcsh" – news ·newspapers ·books ·scholar ·JSTOR
(April 2024) (Learn how and when to remove this message)
TENEX C Shell
Screenshot of a sample tcsh session
DevelopersKen Greer, Paul Placeway, Christos Zoulas, et al.
Stable release
6.24.16[1] Edit this on Wikidata / 9 July 2025; 4 months ago (9 July 2025)
Repository
Written inC
Operating systemCross-platform
TypeUnix shell
License2002:BSD-3-Clause[2][3]
1991:BSD-4-Clause[4]
Websitewww.tcsh.org

tcsh (/ˌtˈsʃɛl/ “tee-see-shell”,/ˈtʃɛl/ “tee-shell”, or as “tee see ess aitch”,tcsh) is aUnix shell based on andbackward compatible with theC shell (csh).

Shell

[edit]

It is essentially the C shell with programmablecommand-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, includingFreeBSD 13 and earlier. (FreeBSD 14 changed the default root shell tosh to match the default user shell[5] whereasOpenBSD uses theKorn shellksh for both root and regular users.[6])

tcsh added filename and command completion and command line editing concepts borrowed from theTENEX operating system, which is the source of the “t”.[7] Because it only added functionality and did not change what was there, tcsh remainedbackward compatible[8] with the original C shell. Though it started as a side branch from the original csh source tree thatBill 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 asmacOS andRed Hat Linux,csh is actuallytcsh. Often one of the two files is either ahard link or asymbolic 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).

OnDebian and some derivatives (includingUbuntu), 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]

History

[edit]

The “t” intcsh comes from the “T” inTENEX, anoperating system which inspired Ken Greer atCarnegie 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]

Significant features

[edit]
  • Command history
    • The built-inhistory 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 usingcommand history
      • !! executes the previous command
      • !n executes the nth command that was previously executed
      • !-n executes the command that was executedn commands ago
      • !string executes the most recently executed command that starts withstring
      • !?string executes the most recently executed command that containsstring
    • 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"=~[0-9]*)thenecho"the input starts with an integer"elseecho"the input does NOT start with an integer"endif
  • Job control
  • The built-inwhere command. Works like thewhich command but showsall locations of the target command in the directories specified in$PATH rather than only the one that will be used.

Deployment

[edit]

Early versions of Mac OS X shipped with tcsh as the default shell, but the default for new accounts becamebash as of10.3, thenzsh as of10.15. (tcsh is still provided, and upgrading the OS does not change the shell of any existing accounts). tcsh was the default root shell ofFreeBSD prior to 14.0 (when it switched to anAlmquist shell derivative which was already the default user shell)[15] and its descendants likeDragonFly BSD andDesktopBSD.

See also

[edit]

References

[edit]
  1. ^"Release 6.24.16". 9 July 2025. Retrieved18 July 2025.
  2. ^"remove clause 3 of the copyright".GitHub. 2002-03-08.
  3. ^"Remove clause 3 of the copyright (changed in other files 2002-03-08)".GitHub. 2014-07-14.
  4. ^"Tcsh-6.00 release".GitHub. 1991-07-04.
  5. ^"FreeBSD Quickstart Guide for Linux Users".
  6. ^"OpenBSD for Linux Users".
  7. ^abcdKen Greer (3 Oct 1983)."C shell with command and filename recognition/completion".Newsgroupnet.sources. Retrieved29 December 2010.
  8. ^tcsh(1) man page. tcsh.
  9. ^Fixes file in tcsh-17 June 2000.
  10. ^Ubuntu - Details of package csh. launchpad.net.
  11. ^Debian - Details of package csh. tracker.debian.org.
  12. ^Ubuntu - Details of package tcsh. launchpad.net.
  13. ^Debian - Details of package tcsh. tracker.debian.org.
  14. ^"The T in tcsh". Archived fromthe original on 14 April 2012. Retrieved31 October 2013.
  15. ^"FreeeBSD 14.0 Release Notes".

External links

[edit]
Retrieved from "https://en.wikipedia.org/w/index.php?title=Tcsh&oldid=1302988680"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp