pavement

Alias (command)

From FreeBSDwiki
Revision as of 05:11, 2 August 2012 by DavidYoung (Talk | contribs)
Jump to: navigation, search

The alias command is used to create aliases, and to get a list of aliased commands.

Contents

Aliases creation

The syntax is shell dependent:

B-Shell (sh, bash) and Z-Shell (zsh) :

alias l=ls
alias la='ls -A'

C-Shell (csh, tcsh) :

alias l ls
alias la 'ls -A'

Special functions

Some shells provide additional features, such as the -g argument of zsh's alias built-in command. This allow creation of global aliases :

> alias a=aaa
> alias -g b=bbb
> echo a b
a bbb

This can be very useful :

> alias -g ...='../..'
> pwd
/foo/bar/misc
> cd ...
> pwd
/foo

For more information on the specific options of your shell, check its man page.

Aliases consultation

You can use this to get a list of existing aliases:

> alias
...=../..
....=../../..
.....=../../../..
......=../../../../..
.......=../../../../../..
clean='rm -f `find . -name "*~" -o -name ".*~" -o -name ".*.core" -o -name "*.core" -o -name "#*#" -o -name "a.out"`
close='cdcontrol -f /dev/cd0 close'
eject='cdcontrol -f /dev/cd0 eject'
fr='export LANG=fr_FR.ISO8859-15'
la='ls -a'
ll='ls -Al'
ls='ls -FG'
> alias ls
ls='ls -FG'

See also: unalias, which

The Way of the Peaceful Parent

The Way is only learned by walking it. Here are the steps I recommend:* Greet your child each morning with a smile, a hug, a loving Good Morning! This is how we would all like to be greeted each day.

[The Way of the Peaceful Parent]

[GoodvilleNews.com - good, positive news, inspirational stories, articles]

5 Great Lessons You Can Learn From Life

Life isnt meant to be easy, its meant to be lived..sometimes happy, other times rough. But with every up and down you learn lessons that make you strong.Can you step back from your own mind for a little while and realize that life is not as bad as you think it is?

[5 Great Lessons You Can Learn From Life]

[GoodvilleNews.com - good, positive news, inspirational stories, articles]

Pilgrims for Peace: One Couples Incredible Journey

"In the life of each and every one of us, there is a defining moment, one after which we know that our lives will never be the same. For me, 9/11 was that moment." Mony Dojeijis defining moment eventually led her to an ancient pilgrimage route in Spain, where a chance encounter with an artist would change both of their lives forever. Together they would end up walking a pilgrimage for peace in Jerusalem -- and in the process would uncover precious insights about themselves, each other and the goodness of humanity.

[Pilgrims for Peace: One Couples Incredible Journey]

[GoodvilleNews.com - good, positive news, inspirational stories, articles]

New Toilet System Transform Waste into Electricity

Scientists from Nanyang Technological University (NTU) have invented a new toilet system that will turn human waste into electricity and fertilisers and also reduce the amount of water needed for flushing by up to 90 per cent compared to current toilet systems in Singapore.

[New Toilet System Transform Waste into Electricity]

[GoodvilleNews.com - good, positive news, inspirational stories, articles]

What Is Your Legacy? Living A Meaningful life

I want the world to be better because I was here. I want my life, I want my work, my family, I want it to mean something and if you are not making someone elses life better then you are wasting your time Will Smith

[What Is Your Legacy? Living A Meaningful life]

[GoodvilleNews.com - good, positive news, inspirational stories, articles]

Personal tools