Doctor Bob
Linux Topic
Search

 
TOURBUS
HOME PAGE
SAVVY
CONSUMER
FREE TECH
SUPPORT

LINUX BASICS

What Are Linux File Aliases Used For?

Aliases: Create Meaningful Synonyms for Commands

Defining an alias is another way to minimize your work at the keyboard, and you can also eliminate the need to remember long, awkward commands by creating synonyms that are more meaningful to you. Here are some examples:
alias dir='ls -l'
alias dogs='find . -name "*dog*" -print'

In this example, the first alias tells bash that when you enter dir on the command line, it should actually execute the ls -l command instead. If you're a hard-core DOS user, you could use alias to create DOS-like synonyms for many Linux commands.

The second alias lets you enter dogs instead of that long, ugly find command shown above. Don't worry about the ls and find commands right now. Just keep in mind that the alias command can save you some keystrokes and make it easier to remember a command.

Undoubtedly you will find other clever things to do with the alias command and add them to your .profile file so they will be available each time you log in. Your .profile file contains a series of comm ands that bash executes automatically when you log in, similar to autoexec.bat the DOS world.

For more information on the alias command, see the alias manual.

Previous Lesson: Command History
Next Lesson: Redirection

[ RETURN TO INDEX ]




Ask Bob Rankin - Free Tech Support
<Send This Link to a Friend>         <Help>         <Bookmark This Page>


Copyright © by Bob Rankin
All rights reserved - Redistribution is allowed only with permission.