Linux Basics (tutorial) #9

Discuss everything about Linux here!

Moderator: Community Moderator

Post Reply
User avatar
MrNiitriiX
Premium Uploader
Premium Uploader
Posts: 2197
Joined: 19 Apr 2010, 14:52
Location: between space and time
Has thanked: 24 times
Been thanked: 164 times

Linux Basics (tutorial) #9

Post by MrNiitriiX »

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.

LINKS TO THE OTHER TUTORIALS


Leason 1: Living in a shell
Leason 2: Root and Other Users
Leason 3: Virtual Consoles
Leason 4: Logoff and Shutdown
Leason 5: Choosing a Shell
Leason 6: The Command Prompt
Leason 7: Wildcards
Leason 8: Command History and Editing
Leason 9: Aliases
Leason 10: Redirection
Leason 11: Pipelines
Leason 12: Processes
Leason 13: Stopping a Program
Leason 14: Environment Variables
Leason 15: Help!
Last edited by MrNiitriiX on 31 Jul 2010, 13:04, edited 1 time in total.
"Injustice anywhere is a threat to justice everywhere." - Martin Luther King
Image
Upload List
Post Reply

Return to “Everything Linux”