Syntax

This section describes the many symbols used by tcsh. The topics are arranged as follows:

  • Special files

  • Filename metacharacters

  • Quoting

  • Command forms

  • Redirection forms

Special Files

Filename

Description

~/.tcshrc or ~/.cshrc

Executed at each instance of shell startup. If no ~/.tcshrc is found, tcsh uses ~/.cshrc if present.

~/.login

Executed by login shell after .tcshrc at login.

~/.cshdirs

Executed by login shell after .login.

~/.logout

Executed by login shell at logout.

/etc/passwd

Source of home directories for ~ name abbreviations.

Filename Metacharacters

Characters

Meaning

*

Match any string of 0 or more characters.

?

Match any single character.

[ abc ...]

Match any one of the enclosed characters; a hyphen can be used to specify a range (e.g., a-z, A-Z, 0-9).

{ abc,xxx,...}

Expand each comma-separated string inside braces.

~

Home directory for the current user.

~ name

Home directory of user name.

Examples

% ls new*          
                  Match new and new.1
% cat ch?          
                  Match ch9 but not ch10
% vi [D-R]*        
                  Match files that begin with uppercase D through R
% ls {ch,app}?     
                  Expand, then match ch1, ch2, app1, app2
% cd ~tom          
                  Change to tom's home directory

Quoting

Quoting disables a character’s special meaning and allows it to be used literally, as itself. The characters in the following table have special meaning to tcsh.

Characters

Description

;

Command separator

&

Background execution

( )

Command grouping

|

Pipe

* ? [ ] ~

Filename metacharacters ...

Get Linux in a Nutshell, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.