Tech tips form Tech Republic


Subject: Tech tips form Tech Republic
From: Mike Barsalou (mbarsalou@aidea.org)
Date: Tue Nov 20 2001 - 08:11:35 AKST


Here are some more great tips from Tech Republic. Have I mentioned that you
should become a member if your not already? :)

USING WILDCARDS ON THE COMMAND LINE

For most Linux newcomers, the command line is the last thing they want
to learn for fear that it may be extremely difficult. Yet mastering the
command line will make using Linux easier and allow users to do more
powerful things.

One topic to learn about the command line is the different wildcards you
can use. There are four types of wildcards in BASH that will come in
handy when performing tasks, such as searching for files and executing
commands against a group of files. These wildcards are as follows:

* *: Matches any character or number of characters

* ?: Matches any single character in a string

* [...]: Matches any single character within the brackets

* {...}: Matches a specified range of characters within the braces

For example, you'll obtain a list of all files ending in ".txt" if you
type:

# ls *.txt

But if you type:

# ls document?.txt

you'll get a list of all files that start with "document," have one
additional character, and end in ".txt".

And if you type:

# ls doc[1-3].txt

you'll get a list of the files "doc1.txt", "doc2.txt", and "doc3.txt"
(if they actually exist).

However, the most powerful and versatile wildcard of the bunch is the
ranged wildcard, which we can illustrate like this:

# ls {pics,MyPics/garden/{roses,lilies},gfx}/*.jpg

This will list all of the files ending in ".jpg" in the directories
pics/, MyPics/garden/roses, MyPics/garden/lilies, and gfx/.



This archive was generated by hypermail 2a23 : Tue Nov 20 2001 - 08:20:24 AKST