Aliases

To use aliases, you must first understand what an alias is. An alias is a file that represents another object in the file system. For example, if you specify a file that just says grepnow, inside it you may have a complex grep command with REs (regular expressions) and/or many options. Typing grepnow at the shell prompt will execute that file's contents, which will be the longer command. What would you rather type out?

grepnow
grep "[:digit:]\{3\}[ -]\?[:digit:]\{4\}" file

The choice is clear. Using aliases can really save you time on frequently entered commands, especially if they are long in syntax.

Suppose you want to match a specific number of repetitions of a pattern. A good example is a phone number. You could easily search for ...

Get SAMS Teach Yourself Unix in 10 Minutes now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.