<s>
In	O
computing	O
,	O
alias	B-Device
is	O
a	O
command	B-Device
in	O
various	O
command-line	O
interpreters	O
(	O
shells	B-Operating_System
)	O
,	O
which	O
enables	O
a	O
replacement	O
of	O
a	O
word	O
by	O
another	O
string	O
.	O
</s>
<s>
It	O
is	O
mainly	O
used	O
for	O
abbreviating	O
a	O
system	B-Application
command	I-Application
,	O
or	O
for	O
adding	O
default	O
arguments	O
to	O
a	O
regularly	O
used	O
command	B-Device
.	O
</s>
<s>
alias	B-Device
is	O
available	O
in	O
Unix	B-Application
shells	I-Application
,	O
AmigaDOS	B-Operating_System
,	O
4DOS/4NT	O
,	O
KolibriOS	B-Operating_System
,	O
Windows	B-Application
PowerShell	I-Application
,	O
ReactOS	B-Application
,	O
and	O
the	O
EFI	B-Architecture
shell	I-Architecture
.	O
</s>
<s>
Aliasing	O
functionality	O
in	O
the	O
MS-DOS	B-Application
and	O
Microsoft	B-Application
Windows	I-Application
operating	I-Application
systems	I-Application
is	O
provided	O
by	O
the	O
DOSKey	B-Device
command-line	O
utility	O
.	O
</s>
<s>
An	O
alias	B-Device
will	O
last	O
for	O
the	O
life	O
of	O
the	O
shell	O
session	O
.	O
</s>
<s>
Regularly	O
used	O
aliases	O
can	O
be	O
set	O
from	O
the	O
shell	O
's	O
rc	B-Protocol
file	I-Protocol
(	O
such	O
as	O
.bashrc	O
)	O
so	O
that	O
they	O
will	O
be	O
available	O
upon	O
the	O
start	O
of	O
the	O
corresponding	O
shell	O
session	O
.	O
</s>
<s>
The	O
alias	B-Device
commands	O
may	O
either	O
be	O
written	O
in	O
the	O
config	B-Protocol
file	I-Protocol
directly	O
or	O
sourced	O
from	O
a	O
separate	O
file	O
.	O
</s>
<s>
In	O
Unix	B-Application
,	O
aliases	O
were	O
introduced	O
in	O
the	O
C	B-Operating_System
shell	I-Operating_System
and	O
survive	O
in	O
descendant	O
shells	B-Operating_System
such	O
as	O
tcsh	B-Language
and	O
bash	B-Operating_System
.	O
</s>
<s>
C	B-Operating_System
shell	I-Operating_System
aliases	O
were	O
strictly	O
limited	O
to	O
one	O
line	O
.	O
</s>
<s>
Older	O
versions	O
of	O
the	B-Device
Bourne	I-Device
shell	I-Device
did	O
not	O
offer	O
aliases	O
,	O
but	O
it	O
did	O
provide	O
functions	O
,	O
which	O
are	O
more	O
powerful	O
than	O
the	O
csh	O
alias	B-Device
concept	O
.	O
</s>
<s>
The	O
alias	B-Device
concept	O
from	O
csh	O
was	O
imported	O
into	O
Bourne	B-Operating_System
Again	I-Operating_System
Shell	I-Operating_System
(	O
bash	B-Operating_System
)	O
and	O
the	O
Korn	B-Language
shell	I-Language
(	O
ksh	O
)	O
.	O
</s>
<s>
With	O
shells	B-Operating_System
that	O
support	O
both	O
functions	O
and	O
aliases	O
but	O
no	O
parameterized	O
inline	O
shell	B-Language
scripts	I-Language
,	O
the	O
use	O
of	O
functions	O
wherever	O
possible	O
is	O
recommended	O
.	O
</s>
<s>
Cases	O
where	O
aliases	O
are	O
necessary	O
include	O
situations	O
where	O
chained	O
aliases	O
are	O
required	O
(	O
bash	B-Operating_System
and	O
ksh	O
)	O
.	O
</s>
<s>
The	O
command	B-Device
has	O
also	O
been	O
ported	O
to	O
the	O
IBM	B-Application
i	I-Application
operating	O
system	O
.	O
</s>
<s>
Non-persistent	O
aliases	O
can	O
be	O
created	O
by	O
supplying	O
name/value	O
pairs	O
as	O
arguments	O
for	O
the	O
alias	B-Device
command	B-Device
.	O
</s>
<s>
In	O
Unix	B-Application
shells	I-Application
the	O
syntax	O
is	O
:	O
</s>
<s>
The	O
corresponding	O
syntax	O
in	O
the	O
C	B-Operating_System
shell	I-Operating_System
or	O
tcsh	B-Language
shell	O
is	O
:	O
</s>
<s>
This	O
alias	B-Device
means	O
that	O
when	O
the	O
command	B-Device
gc	O
is	O
read	O
in	O
the	O
shell	O
,	O
it	O
will	O
be	O
replaced	O
with	O
git	B-Application
commit	O
and	O
that	O
command	B-Device
will	O
be	O
executed	O
instead	O
.	O
</s>
<s>
In	O
the	O
4DOS/4NT	O
shell	O
the	O
following	O
syntax	O
is	O
used	O
to	O
define	O
cp	O
as	O
an	O
alias	B-Device
for	O
the	O
4DOS	B-Application
copy	B-Device
command	B-Device
:	O
</s>
<s>
To	O
create	O
a	O
new	O
alias	B-Device
in	O
Windows	B-Application
PowerShell	I-Application
,	O
the	O
new-alias	O
cmdlet	O
can	O
be	O
used	O
:	O
</s>
<s>
This	O
creates	O
a	O
new	O
alias	B-Device
called	O
ci	O
that	O
will	O
be	O
replaced	O
with	O
the	O
copy-item	O
cmdlet	O
when	O
executed	O
.	O
</s>
<s>
In	O
PowerShell	B-Application
,	O
an	O
alias	B-Device
cannot	O
be	O
used	O
to	O
specify	O
default	O
arguments	O
for	O
a	O
command	B-Device
.	O
</s>
<s>
Instead	O
,	O
this	O
must	O
be	O
done	O
by	O
adding	O
items	O
to	O
the	O
collection	O
$PSDefaultParameterValues	O
,	O
one	O
of	O
the	O
PowerShell	B-Application
preference	O
variables	O
.	O
</s>
<s>
In	O
Unix	B-Application
shells	I-Application
,	O
it	O
is	O
possible	O
to	O
override	O
an	O
alias	B-Device
by	O
quoting	O
any	O
character	O
in	O
the	O
alias	B-Device
name	O
when	O
using	O
the	O
alias	B-Device
.	O
</s>
<s>
For	O
example	O
,	O
consider	O
the	O
following	O
alias	B-Device
definition	O
:	O
</s>
<s>
To	O
override	O
this	O
alias	B-Device
and	O
execute	O
the	O
ls	B-Application
command	B-Device
as	O
it	O
was	O
originally	O
defined	O
,	O
the	O
following	O
syntax	O
can	O
be	O
used	O
:	O
</s>
<s>
In	O
the	O
4DOS/4NT	O
shell	O
it	O
is	O
possible	O
to	O
override	O
an	O
alias	B-Device
by	O
prefixing	O
it	O
with	O
an	O
asterisk	O
.	O
</s>
<s>
For	O
example	O
,	O
consider	O
the	O
following	O
alias	B-Device
definition	O
:	O
</s>
<s>
The	O
asterisk	O
in	O
the	O
2nd	O
instance	O
of	O
dir	B-Device
causes	O
the	O
unaliased	O
dir	B-Device
to	O
be	O
invoked	O
,	O
preventing	O
recursive	O
alias	B-Device
expansion	O
.	O
</s>
<s>
Also	O
the	O
user	O
can	O
get	O
the	O
unaliased	O
behaviour	O
of	O
dir	B-Device
at	O
the	O
command	B-Device
line	O
by	O
using	O
the	O
same	O
syntax	O
:	O
</s>
<s>
In	O
Windows	B-Application
PowerShell	I-Application
,	O
the	O
set	O
verb	O
can	O
be	O
used	O
with	O
the	O
alias	B-Device
cmdlet	O
to	O
change	O
an	O
existing	O
alias	B-Device
:	O
</s>
<s>
The	O
alias	B-Device
ci	O
will	O
now	O
point	O
to	O
the	O
cls	O
command	B-Device
.	O
</s>
<s>
In	O
the	O
4DOS/4NT	O
shell	O
,	O
the	O
eset	O
command	B-Device
provides	O
an	O
interactive	O
command	B-Device
line	O
to	O
edit	O
an	O
existing	O
alias	B-Device
:	O
</s>
<s>
The	O
/a	O
causes	O
the	O
alias	B-Device
cp	O
to	O
be	O
edited	O
,	O
as	O
opposed	O
to	O
an	O
environment	O
variable	O
of	O
the	O
same	O
name	O
.	O
</s>
<s>
In	O
Unix	B-Application
shells	I-Application
and	O
4DOS/4NT	O
,	O
aliases	O
can	O
be	O
removed	O
by	O
executing	O
the	O
unalias	O
command	B-Device
:	O
</s>
<s>
In	O
Windows	B-Application
PowerShell	I-Application
,	O
the	O
alias	B-Device
can	O
be	O
removed	O
from	O
the	O
alias	B-Device
:	O
\	O
drive	O
using	O
remove-item	O
:	O
</s>
<s>
An	O
alias	B-Device
usually	O
replaces	O
just	O
the	O
first	O
word	O
.	O
</s>
<s>
But	O
some	O
shells	B-Operating_System
,	O
such	O
as	O
and	O
,	O
allow	O
a	O
sequence	O
or	O
words	O
to	O
be	O
replaced	O
.	O
</s>
<s>
The	O
usual	O
syntax	O
is	O
to	O
define	O
the	O
first	O
alias	B-Device
with	O
a	O
trailing	O
space	O
character	O
.	O
</s>
<s>
for	O
a	O
long	O
listing	O
,	O
where	O
"	O
long	O
"	O
is	O
also	O
evaluated	O
as	O
an	O
alias	B-Device
.	O
</s>
<s>
In	O
the	O
C	B-Operating_System
Shell	I-Operating_System
,	O
arguments	O
can	O
be	O
embedded	O
inside	O
the	O
command	B-Device
using	O
the	O
string	O
.	O
</s>
<s>
For	O
example	O
,	O
with	O
this	O
alias	B-Device
:	O
</s>
<s>
ls-more	O
/etc	O
/usr	O
expands	O
to	O
ls	B-Application
/etc	O
/usr	O
|	O
more	O
to	O
list	O
the	O
contents	O
of	O
the	O
directories	O
/etc	O
and	O
/usr	O
,	O
pausing	O
after	O
every	O
screenful	O
.	O
</s>
<s>
would	O
instead	O
expand	O
to	O
ls	B-Application
|	O
more	O
/etc	O
/usr	O
which	O
incorrectly	O
attempts	O
to	O
open	O
the	O
directories	O
in	O
more	O
.	O
</s>
<s>
The	O
Bash	B-Operating_System
and	O
Korn	B-Language
shells	I-Language
instead	O
use	O
shell	O
functions	O
—	O
see	O
§	O
Alternatives	O
below	O
.	O
</s>
<s>
Shell	B-Language
scripts	I-Language
,	O
which	O
essentially	O
provide	O
the	O
full	O
ability	O
to	O
create	O
new	O
system	B-Application
commands	I-Application
.	O
</s>
<s>
Symbolic	B-Application
links	I-Application
in	O
the	O
user	O
's	O
PATH	B-Application
(	O
such	O
as	O
/bin	O
)	O
.	O
</s>
<s>
This	O
method	O
is	O
useful	O
for	O
providing	O
an	O
additional	O
way	O
of	O
calling	O
the	O
command	B-Device
,	O
and	O
in	O
some	O
cases	O
may	O
allow	O
access	O
to	O
a	O
buried	O
command	B-Device
function	O
for	O
the	O
small	O
number	O
of	O
commands	O
that	O
use	O
their	O
invocation	O
name	O
to	O
select	O
the	O
mode	O
of	O
operation	O
.	O
</s>
<s>
Shell	O
functions	O
,	O
especially	O
if	O
the	O
command	B-Device
being	O
created	O
needs	O
to	O
modify	O
the	O
internal	O
runtime	B-Device
environment	I-Device
of	O
the	O
shell	O
itself	O
(	O
such	O
as	O
environment	O
variables	O
)	O
,	O
needs	O
to	O
change	O
the	O
shell	O
's	O
current	B-Application
working	I-Application
directory	I-Application
,	O
or	O
must	O
be	O
implemented	O
in	O
a	O
way	O
which	O
guarantees	O
they	O
it	O
appear	O
in	O
the	O
command	B-Device
search	B-Application
path	I-Application
for	O
anything	O
but	O
an	O
interactive	O
shell	O
(	O
especially	O
any	O
"	O
safer	O
"	O
version	O
of	O
,	O
,	O
and	O
so	O
forth	O
)	O
.	O
</s>
<s>
The	O
most	O
common	O
form	O
of	O
aliases	O
,	O
which	O
just	O
add	O
a	O
few	O
options	O
to	O
a	O
command	B-Device
and	O
then	O
include	O
the	O
rest	O
of	O
the	O
command	B-Device
line	O
,	O
can	O
be	O
converted	O
easily	O
to	O
shell	O
functions	O
following	O
this	O
pattern	O
:	O
</s>
<s>
To	O
prevent	O
a	O
function	O
from	O
calling	O
itself	O
recursively	O
,	O
use	O
command	B-Device
:	O
</s>
<s>
In	O
older	O
Bourne	B-Device
shells	I-Device
use	O
/bin/ls	O
instead	O
of	O
command	B-Device
ls	B-Application
.	O
</s>
