Skip to Content
Linux in a Nutshell, 6th Edition
book

Linux in a Nutshell, 6th Edition

by Ellen Siever, Stephen Figgins, Robert Love, Arnold Robbins
September 2009
Beginner
942 pages
85h 34m
English
O'Reilly Media, Inc.
Content preview from Linux in a Nutshell, 6th Edition

Filename Metacharacters

Characters

Meaning

*

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...], [^ 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).

With the extglob option on:

Characters

Meaning

?( 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.

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.

Bash supports 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

graph

Nonspace characters

alpha

Alphabetic characters

print

Printable characters

blank

Space or tab

punct

Punctuation characters

cntrl

Control characters

space

Whitespace characters

digit

Decimal digits

upper

Uppercase characters

lower

Lowercase characters

xdigit

Hexadecimal digits

Bash also accepts ...

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

Unix in a Nutshell, 4th Edition

Unix in a Nutshell, 4th Edition

Arnold Robbins
Linux Under the Hood

Linux Under the Hood

Sander van Vugt
Linux Kernel in a Nutshell

Linux Kernel in a Nutshell

Greg Kroah-Hartman

Publisher Resources

ISBN: 9780596806088Errata Page