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 Section 2.3.1, 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 POSIX.1‐2017, the alias
26       definition shall not affect the parent process of the current shell nor
27       any  utility  environment invoked by the shell; see Section 2.12, Shell
28       Execution 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                 Assign the value of string to the alias alias-name.
41
42       If no operands are given, all alias definitions  shall  be  written  to
43       standard output.
44

STDIN

46       Not used.
47

INPUT FILES

49       None.
50

ENVIRONMENT VARIABLES

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

ASYNCHRONOUS EVENTS

77       Default.
78

STDOUT

80       The format for displaying aliases (when no operands or only name  oper‐
81       ands are specified) shall be:
82
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
119               alias lf="ls -CF"
120
121        2. Create a simple ``redo'' command to repeat previous entries in  the
122           command history file:
123
124
125               alias r='fc -s'
126
127        3. Use 1K units for du:
128
129
130               alias du=du\ -k
131
132        4. Set up nohup so that it can deal with an argument that is itself an
133           alias name:
134
135
136               alias nohup="nohup "
137

RATIONALE

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

FUTURE DIRECTIONS

161       None.
162

SEE ALSO

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