1ALIAS(1P)                  POSIX Programmer's Manual                 ALIAS(1P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       alias - define or display aliases
13

SYNOPSIS

15       alias [alias-name[=string] ...]
16

DESCRIPTION

18       The alias utility shall create or redefine alias definitions  or  write
19       the  values  of existing alias definitions to standard output. An alias
20       definition provides a string value that shall replace  a  command  name
21       when it is encountered; see Alias Substitution .
22
23       An  alias  definition shall affect the current shell execution environ‐
24       ment and the execution environments of the  subshells  of  the  current
25       shell.  When  used as specified by this volume of IEEE Std 1003.1-2001,
26       the alias definition shall not affect the parent process of the current
27       shell  nor any utility environment invoked by the shell; see Shell Exe‐
28       cution Environment .
29

OPTIONS

31       None.
32

OPERANDS

34       The following operands shall be supported:
35
36       alias-name
37              Write the alias definition to standard output.
38
39       alias-name=string
40
41              Assign the value of string to the alias alias-name.
42
43
44       If no operands are given, all alias definitions  shall  be  written  to
45       standard output.
46

STDIN

48       Not used.
49

INPUT FILES

51       None.
52

ENVIRONMENT VARIABLES

54       The  following  environment  variables  shall  affect  the execution of
55       alias:
56
57       LANG   Provide a default value for the  internationalization  variables
58              that  are  unset  or  null.  (See the Base Definitions volume of
59              IEEE Std 1003.1-2001, Section  8.2,  Internationalization  Vari‐
60              ables  for the precedence of internationalization variables used
61              to determine the values of locale categories.)
62
63       LC_ALL If set to a non-empty string value, override the values  of  all
64              the other internationalization variables.
65
66       LC_CTYPE
67              Determine  the  locale  for  the  interpretation of sequences of
68              bytes of text data as characters (for  example,  single-byte  as
69              opposed to multi-byte characters in arguments).
70
71       LC_MESSAGES
72              Determine  the  locale  that should be used to affect the format
73              and contents of diagnostic messages written to standard error.
74
75       NLSPATH
76              Determine the location of message catalogs for the processing of
77              LC_MESSAGES .
78
79

ASYNCHRONOUS EVENTS

81       Default.
82

STDOUT

84       The  format for displaying aliases (when no operands or only name oper‐
85       ands are specified) shall be:
86
87
88              "%s=%s\n", name, value
89
90       The value string shall be written with appropriate quoting so  that  it
91       is  suitable  for  reinput  to  the shell. See the description of shell
92       quoting in Quoting .
93

STDERR

95       The standard error shall be used only for diagnostic messages.
96

OUTPUT FILES

98       None.
99

EXTENDED DESCRIPTION

101       None.
102

EXIT STATUS

104       The following exit values shall be returned:
105
106        0     Successful completion.
107
108       >0     One of the name operands specified did not have an alias defini‐
109              tion, or an error occurred.
110
111

CONSEQUENCES OF ERRORS

113       Default.
114
115       The following sections are informative.
116

APPLICATION USAGE

118       None.
119

EXAMPLES

121        1. Change ls to give a columnated, more annotated output:
122
123
124           alias ls="ls -CF"
125
126        2. Create  a  simple  "redo" command to repeat previous entries in the
127           command history file:
128
129
130           alias r='fc -s'
131
132        3. Use 1K units for du:
133
134
135           alias du=du\ -k
136
137        4. Set up nohup so that it can deal with an argument that is itself an
138           alias name:
139
140
141           alias nohup="nohup "
142

RATIONALE

144       The alias description is based on historical KornShell implementations.
145       Known differences exist between that and the  C  shell.  The  KornShell
146       version  was adopted to be consistent with all the other KornShell fea‐
147       tures in this volume of  IEEE Std 1003.1-2001,  such  as  command  line
148       editing.
149
150       Since alias affects the current shell execution environment, it is gen‐
151       erally provided as a shell regular built-in.
152
153       Historical versions  of  the  KornShell  have  allowed  aliases  to  be
154       exported  to  scripts that are invoked by the same shell. This is trig‐
155       gered  by  the  alias  -x  flag;  it  is  allowed  by  this  volume  of
156       IEEE Std 1003.1-2001  only  when  an  explicit  extension such as -x is
157       used. The standard developers considered that aliases were of use  pri‐
158       marily  to  interactive  users and that they should normally not affect
159       shell scripts called by those users; functions are  available  to  such
160       scripts.
161
162       Historical  versions  of  the  KornShell  had  not written aliases in a
163       quoted manner suitable for reentry to the shell,  but  this  volume  of
164       IEEE Std 1003.1-2001  has  made this a requirement for all similar out‐
165       put. Therefore, consistency with this  volume  of  IEEE Std 1003.1-2001
166       was chosen over this detail of historical practice.
167

FUTURE DIRECTIONS

169       None.
170

SEE ALSO

172       Function Definition Command
173
175       Portions  of  this text are reprinted and reproduced in electronic form
176       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
177       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
178       Specifications Issue 6, Copyright (C) 2001-2003  by  the  Institute  of
179       Electrical  and  Electronics  Engineers, Inc and The Open Group. In the
180       event of any discrepancy between this version and the original IEEE and
181       The  Open Group Standard, the original IEEE and The Open Group Standard
182       is the referee document. The original Standard can be  obtained  online
183       at http://www.opengroup.org/unix/online.html .
184
185
186
187IEEE/The Open Group                  2003                            ALIAS(1P)
Impressum