Skip to Main Content
Unix in a Nutshell, 4th Edition
book

Unix in a Nutshell, 4th Edition

by Arnold Robbins
October 2005
Intermediate to advanced content levelIntermediate to advanced
908 pages
46h 42m
English
O'Reilly Media, Inc.
Content preview from Unix in a Nutshell, 4th Edition

Filename Metacharacters

*

Match any string of zero or more characters.

?

Match any single character.

[abc...]

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

[!abc...]

Match any character not enclosed as above.

~

Home directory of the current user.

~ name

Home directory of user name.

~+

Current working directory ($PWD).

~-

Previous working directory ($OLDPWD).

In the Korn shell, or Bash with the extglob option on:

?( pattern )

Match zero or one instance of pattern.

*( pattern )

Match zero or more instances of pattern.

+( pattern )

Match one or more instances of pattern.

@( pattern )

Match exactly one instance of pattern.

!( pattern )

Match any strings that don’t match pattern.

\ n

Match the text matched by the n‘th subpattern in (...). ksh93 only.

This pattern can be a sequence of patterns separated by |, meaning that the match applies to any of the patterns. This extended syntax resembles that available in egrep and awk. In the Korn shell, but not in Bash, if & is used instead of |, all the patterns must match. & has higher precedence than |.

ksh93 and Bash support the POSIX [[=c=]] notation for matching characters that have the same weight, and [[.c.]] for specifying collating sequences. In addition, character classes, of the form [[:class:]], allow you to match the following classes of characters.

Class

Characters matched

Class

Characters matched

alnum

Alphanumeric characters ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning the Unix Operating System, 5th Edition

Learning the Unix Operating System, 5th Edition

John Strang, Grace Todino, Jerry Peek
UNIX and Linux System Administration Handbook, 5th Edition

UNIX and Linux System Administration Handbook, 5th Edition

Trent R. Hein, Evi Nemeth, Garth Snyder, Ben Whaley, Dan Mackin

Publisher Resources

ISBN: 0596100299Errata Page