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
11

NAME

13       alias — define or display aliases
14

SYNOPSIS

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

DESCRIPTION

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

OPTIONS

32       None.
33

OPERANDS

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

STDIN

47       Not used.
48

INPUT FILES

50       None.
51

ENVIRONMENT VARIABLES

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

ASYNCHRONOUS EVENTS

78       Default.
79

STDOUT

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

STDERR

91       The standard error shall be used only for diagnostic messages.
92

OUTPUT FILES

94       None.
95

EXTENDED DESCRIPTION

97       None.
98

EXIT STATUS

100       The following exit values shall be returned:
101
102        0    Successful completion.
103
104       >0    One  of the name operands specified did not have an alias defini‐
105             tion, or an error occurred.
106

CONSEQUENCES OF ERRORS

108       Default.
109
110       The following sections are informative.
111

APPLICATION USAGE

113       None.
114

EXAMPLES

116        1. Create a short alias for a commonly used ls command:
117
118               alias lf="ls −CF"
119
120        2. Create a simple ``redo'' command to repeat previous entries in  the
121           command history file:
122
123               alias r='fc −s'
124
125        3. Use 1K units for du:
126
127               alias du=du\ −k
128
129        4. Set up nohup so that it can deal with an argument that is itself an
130           alias name:
131
132               alias nohup="nohup "
133

RATIONALE

135       The alias description is based on historical KornShell implementations.
136       Known  differences  exist  between  that and the C shell. The KornShell
137       version was adopted to be consistent with all the other KornShell  fea‐
138       tures in this volume of POSIX.1‐2008, such as command line editing.
139
140       Since alias affects the current shell execution environment, it is gen‐
141       erally provided as a shell regular built-in.
142
143       Historical versions  of  the  KornShell  have  allowed  aliases  to  be
144       exported  to  scripts that are invoked by the same shell. This is trig‐
145       gered  by  the  alias  −x  flag;  it  is  allowed  by  this  volume  of
146       POSIX.1‐2008  only  when  an explicit extension such as −x is used. The
147       standard developers considered that aliases were of  use  primarily  to
148       interactive  users  and  that  they  should  normally  not affect shell
149       scripts called by those users; functions are available to such scripts.
150
151       Historical versions of the KornShell  had  not  written  aliases  in  a
152       quoted  manner  suitable  for  reentry to the shell, but this volume of
153       POSIX.1‐2008 has made this a requirement for all similar output. There‐
154       fore, consistency was chosen over this detail of historical practice.
155

FUTURE DIRECTIONS

157       None.
158

SEE ALSO

160       Section 2.9.5, Function Definition Command
161
162       The  Base  Definitions  volume  of POSIX.1‐2008, Chapter 8, Environment
163       Variables
164
166       Portions of this text are reprinted and reproduced in  electronic  form
167       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
168       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
169       Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
170       cal and Electronics Engineers,  Inc  and  The  Open  Group.   (This  is
171       POSIX.1-2008  with  the  2013  Technical Corrigendum 1 applied.) In the
172       event of any discrepancy between this version and the original IEEE and
173       The  Open Group Standard, the original IEEE and The Open Group Standard
174       is the referee document. The original Standard can be  obtained  online
175       at http://www.unix.org/online.html .
176
177       Any  typographical  or  formatting  errors that appear in this page are
178       most likely to have been introduced during the conversion of the source
179       files  to  man page format. To report such errors, see https://www.ker
180       nel.org/doc/man-pages/reporting_bugs.html .
181
182
183
184IEEE/The Open Group                  2013                            ALIAS(1P)
Impressum