Special Characters

Several characters have special meaning to the shell.

Character(s)

Description

* ? [ ] ^ { } ˜

Filename pattern matching and expansion

$

Variable reference

|

Pipe

< >

Input and output redirection

! ^

History reference and quick substitution

&

Background execution

;

Command separator

SPACE

Argument separator

TAB

Filename completion (tcsh)

ESC

Filename completion (csh)

(…)

Subshell execution

'…'

Command substitution

\ ' "

Quote characters

Special Characters in Filenames

Filename arguments can contain the following special characters in order to do pattern matching or home-directory substitution.

Character(s)

Description

*

Match an arbitrary length sequence of characters

?

Match a single character

[…]

Match any character named between brackets

[^…]

Match any character not named between brackets (tcsh only)

^pattern

Match filenames not matching pattern (tcsh only)

{…}

String expansion operator

˜

Expands to pathname of your home directory

˜name

Expands to pathname of home directory for user name

Quote Characters

Quote characters turn off any special meaning a character has, allowing it be used as an ordinary character.

Character(s)

Description

\

Quote the following character.

'…'

Quote the characters between single quotes. !event is still evaluated as a history substitution.

"…"

Quote the characters between double quotes. !event, $var, and 'cmd' are still evaluated as history, variable, and command substitutions.

Get Using csh & tcsh 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.