Create a New Temporary Alias


alias [alias]= '[command]'

If you find yourself typing a command over and over again, maybe it's time to make it an alias. For instance, to see just the subdirectories in your current working directory, you'd use ls -d */. To create a temporary alias for that command, use the following:

$ ls -d */ by_pool/  libby_pix/  on_floor/ $ alias lsd='ls -d */' $ lsd by_pool/  libby_pix/  on_floor/ 


You should realize a couple of things about using alias in this way. Your alias name can't have an = in it, which makes sense, because it's immediately followed by an = when you're defining it. You can, however, have an = in the actual alias itself. Also, an alias created in this fashion only lasts as long as this shell session is active. Log out, and your alias is gone.

Want to create an alias that lasts past when you log out? Then read the next section, "Create a New Permanent Alias."



Linux Phrasebook
Linux Phrasebook
ISBN: 0672328380
EAN: 2147483647
Year: 2007
Pages: 288

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net