Skip to Content
Ubuntu: Up and Running
book

Ubuntu: Up and Running

by Robin Nixon
April 2010
Beginner
464 pages
12h 7m
English
O'Reilly Media, Inc.
Content preview from Ubuntu: Up and Running

Wildcards, Sets, and Brace Expansion

We’ve already used wildcards in a few places in this chapter, but there’s a lot more you can do with them than just using the * and ? operators to match strings and characters, respectively, as shown in Table 7-5.

Table 7-5. Wildcards and their meanings

Wildcard

Meaning

*

Any sequence of characters, except for a leading period

?

Any single character, except for a leading period

[set]

Any one of the characters in the set

[ch1-ch2]

Any one of the characters from ch1 through ch2

[^set]

Any single character not in the set

[^ch1-ch2]

Any single character not from ch1 through ch2

{ch,str,etc…}

Match all the characters and/or strings

Using Sets and Ranges

A set of characters placed within a pair of rectangular brackets can match a single character in a file or folder name. This is a more precise version of the ? single-character wildcard. For example, the set [abcdef] will match any of the six characters shown so that [abcdef]ark.txt will match the filenames bark.txt and dark.txt, as long as they both exist. You can also save on typing by using a hyphen to indicate a range of characters so that [a-f] is equivalent to [abcdef].

Another neat thing you can do with a set is force all upper- or all lowercase matches using the ranges [A-Z] or [a-z]. Or you can limit the matching to only alphabetical characters of either case (excluding digits and other characters) by using the set [a-zA-z]. And you can also use numbers in a range, as in [0-9].

Alternatively, you can exclude 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.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Ubuntu Made Easy

Ubuntu Made Easy

Rickford Grant, Phil Bull
Ubuntu for Non-Geeks, 4th Edition

Ubuntu for Non-Geeks, 4th Edition

Rickford Grant, Phil Bull
CentOS Quick Start Guide

CentOS Quick Start Guide

Shiwang Kalkhanda

Publisher Resources

ISBN: 9781449382827Errata Page