28.09.2018 Views

Linux Dummies 9th

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

320<br />

Part IV: Junior Administrator Boot Camp<br />

Putting Wildcard Expansion to Good Use<br />

Computing life would be tedious if you had to repeat the same command<br />

on multiple files. After all, aren’t repetitive tasks what the computer was<br />

designed to do? Wildcard expansion refers to the capability of executing one<br />

command against many files without having to re-enter the command. The<br />

asterisk (*) and the question mark (?) are two wildcard characters that are<br />

used to match any filename, or a portion of a filename. For example, you can<br />

use the following command to see a long directory listing that includes only<br />

files that end with a .doc filename extension:<br />

ls -l *.doc<br />

The files listed may include resume.doc, cover_letter.doc, and to_<br />

editor.doc, for example.<br />

The asterisk wildcard character can match zero or more characters. To match<br />

just a single character, use the question mark.<br />

Working with Long Commands<br />

As you become used to the command line, you should find some shortcuts<br />

to ease your typing chores. In this section, we show you some features of the<br />

bash shell designed to make your life on the command line as pleasant as<br />

possible. These features include automatic command-line completion, editing,<br />

and using the history of previously entered commands.<br />

Asking <strong>Linux</strong> to complete a command<br />

or filename for you<br />

Considering that you do much more typing on the command line in <strong>Linux</strong><br />

than you may normally do in a GUI environment, a feature that provides<br />

typing shortcuts wherever possible is extremely handy. Command completion<br />

is a function of the shell that fills in the rest of the filename and system commands<br />

you start to type.<br />

The capability of the <strong>Linux</strong> filesystem to deal with practically unlimited sizes<br />

of filenames means that many filenames can become huge. Typing these long<br />

filenames can become cumbersome and error-prone. Fortunately, with command<br />

completion, typing a command or a long filename is short work.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!