tcsh - C shell with file name completion and command line editing
| 📌 Use Case | 🖥️ Command | 📝 Description |
|---|---|---|
| Start interactive shell | tcsh | Launch enhanced C shell |
| Execute script | tcsh script.csh | Run commands from file |
| Login shell | tcsh -l | Start as login shell |
| Read commands from stdin | tcsh -s | Interactive reading from stdin |
| Single command execution | tcsh -c "command" | Execute one command and exit |
| Debug script (parse only) | tcsh -n | Parse without executing |
| Echo commands before execution | tcsh -x | Set echo variable |
| Verbose mode (echo after history) | tcsh -v | Set verbose variable |
| Fast startup (no resource files) | tcsh -f | Skip ~/.tcshrc etc. |
| Force fork instead of vfork | tcsh -F | Use fork() for processes |
| List active jobs | jobs | Show background/suspended jobs |
| Bring job to foreground | fg %1 | Resume job 1 in foreground |
| Send job to background | bg %1 | Resume job 1 in background |
| Change directory | cd /path | Change working directory |
| Push directory onto stack | pushd /path | Change dir and push old one |
| Pop directory stack | popd | Return to previous directory |
| Show directory stack | dirs | List directory stack |
| Set environment variable | setenv VAR value | Set env var |
| Set shell variable | set var=value | Set shell variable |
| Unset variable | unset var | Remove shell variable |
| Define alias | alias name 'command' | Create command alias |
| Remove alias | unalias name | Delete alias |
| History list | history | Display command history |
| Repeat last command | !! | Re-execute previous command |
| Use last argument | !$ | Insert last argument of previous command |
| Spelling correction | spell-word (M-s) | Correct current word |
| Complete word | Tab | Auto-complete filename/command/variable |
| List completion choices | ^D | List possible completions |
| Edit command line | Emacs/Vi keys | Inline editing |
| Exit shell | exit or ^D | Terminate shell |
tcsh [-bcdefFimnqstvVxX] [-Dname[=value]] [arg ...]
tcsh -l
tcsh is an enhanced but completely compatible version of the Berkeley UNIX C shell, csh(1). It includes a command-line editor, programmable word completion, spelling correction, history mechanism, job control, and a C-like syntax. Features marked with (+) are not in most csh implementations; features marked with (u) are undocumented in csh.
If the first argument is -, it's a login shell. A login shell can also be specified with -l as the only argument. The rest of the flag arguments are interpreted as follows:
-b – Force break from option processing; remaining arguments are non-option.-c – Commands read from the following argument, stored in command shell variable.-d – Load directory stack from ~/.cshdirs.-Dname[=value] – Set environment variable name to value (Domain/OS only).-e – Exit if any command yields non-zero exit status.-f – Fast start: no resource files, no command hashing.-F – Use fork() instead of vfork().-i – Interactive shell even if not a terminal.-l – Login shell (only flag allowed).-m – Load ~/.tcshrc even if not effective user.-n – Parse commands but do not execute (debugging).-q – Accept SIGQUIT; job control disabled.-s – Read commands from standard input.-t – Read and execute a single line of input.-v – Set verbose variable; echo after history substitution.-x – Set echo variable; echo commands before execution.-V – Set verbose before executing ~/.tcshrc.-X – Like -x, but set before ~/.tcshrc.--help – Print help message and exit.--version – Print version/platform/compilation options.After flag processing, if arguments remain and no -c, -i, -s, or -t was given, the first argument is taken as a script file. Remaining arguments are placed in argv.
Login shells execute system files /etc/csh.cshrc and /etc/csh.login, then user files: ~/.tcshrc (or ~/.cshrc), ~/.history, ~/.login, and ~/.cshdirs. Non-login shells read only /etc/csh.cshrc and ~/.tcshrc/~/.cshrc. At logout, /etc/csh.logout and ~/.logout are executed.
The command-line editor is active when edit is set (default in interactive shells). bindkey displays/configures key bindings. Emacs-style bindings are default. Arrow keys are bound to down-history, up-history, backward-char, forward-char.
Type part of a word and press Tab to complete. ^D lists possible completions. Completion works for filenames, commands, and variables. The complete builtin allows custom completions. Variables like autolist, recexact, fignore, autocorrect, autoexpand, recognize_only_executables affect behavior.
Use M-s (spell-word) or M-$ (spell-line). Set correct to cmd or all for automatic correction. The shell prompts with corrected line; answer y/n/e/a.
Key bindings are listed by bindkey -l. Notable commands: complete-word (Tab), delete-char-or-list-or-eof (^D), expand-history (M-space), history-search-backward (M-p), i-search-back, vi-search-back, spell-word (M-s), run-help (M-h), which-command (M-?), yank-pop (M-y).
Input lines are split at blanks, tabs, and special characters (&, |, ;, <, >, (, ), &&, ||, <<, >>). # starts a comment when input is not a terminal. Quoting with \, ', ", ` prevents special meaning.
History substitutions begin with !. Event specification: n (event number), -n (offset), # (current), ! (previous), s (beginning with string), ?s? (containing string). Word designators: 0 (command), n (argument), ^ (first), $ (last), * (all). Modifiers: h (head), t (tail), r (root), e (extension), u/l (case), s/l/r/ (substitute), & (repeat), g (global), a (apply to single word), p (print), q (quote), x (break into words).
After parsing, the first word of each command is checked for alias. Aliases can contain history references. Alias substitution is repeated until no change.
Variables are referenced with $name or ${name}. Subscripting: $name[selector]. Special variables: $0 (script name), $number (argv), $* (all args), $?name (set test), $#name (word count), $%name (character count), $$ (PID), $! (last background PID), $_ (last command line), $< (read from stdin). Modifiers from history can be applied.
Command substitution: `command`. Filename substitution (globbing): *, ?, [...], {...}, ~ (home), ^ (negation). Directory stack substitution: =n expands to stack entry.
Simple commands, pipelines (|), sequences (;, ||, &&), and background execution (&). Parenthesized commands run in subshell.
Builtins execute within the shell. Non-builtins are searched via path and hashed. The shell emulates #! if compiled.
Redirection: < file, << word, > file, >& file, >> file, >>& file. noclobber prevents overwriting. Diagnostic output can be piped with |&.
foreach, switch, while, if-then-else. Keywords must appear on single input lines.
Logical, arithmetic, comparison operators: ||, &&, |, ^, &, ==, !=, =~, !~, <=, >=, <, >, <<, >>, +, -, *, /, %, !, ~, (, ). =~ and !~ match glob patterns.
Commands in expressions return true (1) if exit status 0, false (0) otherwise.
Test operators: -r, -w, -x, -X, -e, -o, -z, -s, -f, -d, -l, -b, -c, -p, -S, -u, -g, -k, -t, -R, -L. Information operators: -A, -A:, -M, -M:, -C, -C:, -D, -I, -F, -L (link target), -N, -P, -P:, -Pmode, -U, -U:, -G, -G:, -Z. Multiple operators can be combined.
Job control: bg, fg, stop, notify. Jobs referred by %job. Current job marked with +, previous with -.
Shell notifies of job status changes before prompt. notify variable gives immediate notification.
sched for scheduled commands, beepcmd, cwdcmd, periodic, precmd, postcmd, jobcmd special aliases. autologout, mail, printexitvalue, rmstar, time, watch.
8-bit clean, supports character sets via LANG/LC_CTYPE. Printable characters in range \200-\377 are rebound to self-insert-command unless NOREBIND is set.
Builtins for TCF, BS2000, Domain/OS, Mach, Masscomp/RTU, Harris CX/UX, Convex/OS. VENDOR, OSTYPE, MACHTYPE environment variables.
Login shells ignore interrupts when reading ~/.logout. Quit ignored unless -q. Terminate caught by login shells. onintr, hup, nohup control handling.
Three tty mode sets: edit, quote, execute. setty manages fixed modes. echotc, settc, telltc manipulate termcap. Window resizing adjusts LINES/COLUMNS.
List of builtin commands with descriptions. Key entries:
alias – Define/print aliasesbg – Background jobsbindkey – Key bindingscd/chdir – Change directorycomplete – Programmable completionsdirs – Directory stackecho – Print argumentseval – Execute arguments as shell inputexec – Replace shell with commandexit – Exit shellfg – Foreground jobsforeach – Loop over listglob – Filename expandgoto – Jump to labelhistory – Display/save historyif – Conditionaljobs – List jobskill – Send signallimit – Set resource limitslogin/logout – Login/logoutls-F – List files with type indicatorspopd/pushd – Directory stack manipulationrehash – Recompute command hash tablerepeat – Repeat commandsched – Scheduled eventsset/unset – Shell variablessetenv/unsetenv – Environment variablesshift – Shift argvsource – Execute filestop – Stop background jobsuspend – Suspend shellswitch – Multi-way branchtime – Time commandumask – File creation maskunalias – Remove aliasunhash – Disable hashingunlimit – Remove resource limitwait – Wait for background jobswhere – Locate commandwhich – Show command pathwhile – Loopbeepcmd – Runs when bell ringscwdcmd – Runs after directory changejobcmd – Runs before/after command state changehelpcommand – Invoked by run-help editor commandperiodic – Runs every tperiod minutesprecmd – Runs before each promptpostcmd – Runs before each commandshell – Interpreter for scripts without #!Essential variables:
addsuffix – Add / or space after completionautolist – List completions on ambiguousautologout – Automatic logout/lockcdpath – Search path for cdcorrect – Automatic spelling correctioncwd – Current working directorydirstack – Directory stack arrayecho – Echo commands before executionedit – Enable command-line editorfignore – Suffixes to ignore in completiongid/uid – Real user/group IDshistchars – History substitution charactershistfile – History file locationhistlit – Use literal historyhistory – Number of events to savehome – Home directoryignoreeof – Ignore EOF to exitlistjobs – List jobs on suspensionloginsh – Set if login shellmail – Mail check filesnoclobber – Protect against overwritingnoglob – Disable filename globbingnonomatch – Allow unmatched globsnotify – Immediate job status notificationpath – Command search pathprompt – Prompt string with format sequencessavehist – Save history on exitshell – Shell executable pathshlvl – Shell nesting levelstatus – Exit status of last commandsymlinks – Symbolic link handlingtcsh – Version numberterm – Terminal typetime – Automatic timing thresholduser – Login nameversion – Compilation optionsvimode – Vi-style editing modevisiblebell – Screen flash instead of beepwatch – User/terminal watch listwho – Format for watch messageswordchars – Word characters for editorEnvironment variables: AFSUSER, COLUMNS, DISPLAY, EDITOR, GROUP, HOME, HOST, HOSTTYPE, HPATH, LANG, LC_CTYPE, LINES, LS_COLORS, MACHTYPE, NOREBIND, OSTYPE, PATH, PWD, REMOTEHOST, SHLVL, SYSTYPE, TERM, TERMCAP, USER, VENDOR, VISUAL. See descriptions in the manual for details.
/etc/csh.cshrc – Read first by every shell/etc/csh.login – Read by login shells~/.tcshrc – Read by every shell (or ~/.cshrc)~/.history – History file~/.login – Login shell startup~/.cshdirs – Directory stack file/etc/csh.logout – Read at logout~/.logout – User logout script/bin/sh – Interpreter for scripts without #!/tmp/sh* – Temporary files for <</etc/passwd – Home directory source for ~namefiletestbuiltins, hup, ls-F, newgrp, printenv, which, wheregid, loginsh, oid, shlvl, tcsh, tty, uid, versionforeach doesn't ignore here documentsHPATH/NOREBIND shouldn't be env varsif does redirection even if falsels-F includes identification chars in sorttcsh is inspired by the TENEX/TOPS-20 command completion feature. The 't' stands for 'TENEX'.
csh(1), emacs(1), ls(1), newgrp(1), sh(1), setpath(1), stty(1), su(1), tset(1), vi(1), x(1), access(2), execve(2), fork(2), killpg(2), pipe(2), setrlimit(2), sigvec(2), stat(2), umask(2), vfork(2), wait(2), malloc(3), setlocale(3), tty(4), a.out(5), termcap(5), ron(7), termio(7), Introduction to the C Shell
This manual documents tcsh 6.21.00 (Astron) 2019-05-08.
ls-F and which builtinscsh into tcshwordcharsautolist~/.tcshrcprompt3ampm, settc, telltcshlvl, Mach support, correct-lineexpand-lineautolist beeping optionswhereignoreeofcomplete-word-fwd/backellipsis, rpromptBryan Dunlap, Clayton Elwell, Karl Kleinpaste, Bob Manson, Steve Romig, Diana Smetters, Bob Sutterfield, Mark Verber, Elizabeth Zwicky and all the other people at Ohio State for suggestions and encouragement. All the people on the net for bug reports and suggestions. Richard M. Alderson III for writing the 'T in tcsh' section.
```Generated by phpman v4.9.29 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-07-22 04:29 @2600:1f28:365:80b0:8802:8bb4:3873:328e
CrawledBy CCBot/2.0 (https://commoncrawl.org/faq/)
Enhanced by LLM: deepseek-v4-flash / taotoken.net / www.chedong.com - original format