1alias(1)                         User Commands                        alias(1)
2
3
4

NAME

6       alias,  unalias  - create or remove a pseudonym or shorthand for a com‐
7       mand or series of commands
8

SYNOPSIS

10       /usr/bin/alias [alias-name[= string...]]
11
12
13       /usr/bin/unalias alias-name...
14
15
16       /usr/bin/unalias -a
17
18
19   csh
20       alias [name [def]]
21
22
23       unalias pattern
24
25
26   ksh
27       alias [-tx] [name[= value]...]
28
29
30       unalias name...
31
32
33       unalias [-a]
34
35
36   ksh93
37       alias [-ptx] [name[= value]...]
38
39
40       unalias [-a] [name...]
41
42

DESCRIPTION

44       The alias and unalias utilities create or remove a pseudonym or  short‐
45       hand term for a command or series of commands, with different function‐
46       ality in the C-shell and Korn shell environments.
47
48   /usr/bin/alias
49       The alias utility creates or redefines alias definitions or writes  the
50       values of existing alias definitions to standard output. An alias defi‐
51       nition provides a string value that replaces a command name when it  is
52       encountered.
53
54
55       An alias definition affects the current shell execution environment and
56       the execution environments of the subshells of the current shell.  When
57       used  as  specified  by  this  document,  the alias definition does not
58       affect the parent process of the current shell nor any utility environ‐
59       ment invoked by the shell.
60
61   /usr/bin/unalias
62       The  unalias  utility removes the definition for each alias name speci‐
63       fied. The aliases are removed from the current shell execution environ‐
64       ment. The -a option removes all alias definitions from the current exe‐
65       cution environment.
66
67   csh
68       alias assigns def to the alias name. The assigned  def  is  a  list  of
69       words that can contain escaped history-substitution metasyntax. name is
70       not allowed to be alias or unalias. If def is omitted, the  alias  name
71       is  displayed  along  with its current definition. If both name and def
72       are omitted, all aliases are displayed.
73
74
75       Because of implementation restrictions, an alias definition  must  have
76       been entered on a previous command line before it can be used.
77
78
79       unalias  discards  aliases  that match (filename substitution) pattern.
80       All aliases can be removed by `unalias *'.
81
82   ksh
83       alias with no  arguments  prints  the  list  of  aliases  in  the  form
84       name=value  on standard output. An alias is defined for each name whose
85       value is specified. A trailing space in value causes the next  word  to
86       be  checked for alias substitution. The -t flag is used to set and list
87       tracked aliases. The value of a tracked alias is the full pathname cor‐
88       responding  to the specified name. The value becomes undefined when the
89       value of PATH is reset but the aliases remained tracked. Without the -t
90       flag,  for  each name in the argument list for which no value is speci‐
91       fied, the name and value of the alias is printed. The -x flag  is  used
92       to  set  or  print  exported  aliases. An exported alias is defined for
93       scripts invoked by name. The exit status is non-zero if a name is spec‐
94       ified, but no value, and no alias has been defined for the name.
95
96
97       The aliass specified by the list of names can be removed from the alias
98       list with unalias.
99
100   ksh93
101       alias creates or redefines alias definitions  or  writes  the  existing
102       alias definitions to standard output.
103
104
105       An  alias  definition  provides  a string value that replaces a command
106       name when the command is read. Alias names can  contain  any  printable
107       character that is not special to the shell. If an alias value ends in a
108       SPACE or TAB, the word following the command name the alias replaces is
109       also checked to see whether it is an alias.
110
111
112       If  no  names  are  specified,  the names and values of all aliases are
113       written to standard output. Otherwise, for each name that is specified,
114       and =value is not specified, the current value of the alias correspond‐
115       ing to name is written to standard output. If =value is specified,  the
116       alias name is created or redefined.
117
118
119       alias  is  built-in to the shell as a declaration command so that field
120       splitting and pathname expansion are not performed  on  the  arguments.
121       Tilde  expansion  occurs  on  value.  An  alias definition only affects
122       scripts read by the current  shell  environment.  It  does  not  affect
123       scripts run by this shell.
124
125
126       unalias  removes  the  definition  of each named alias from the current
127       shell execution environment, or all aliases if -a is specified. It does
128       not  affect  any  commands that have already been read and subsequently
129       executed.
130

OPTIONS

132       The following option is supported by unalias:
133
134       -a    Removes all alias definitions from the  current  shell  execution
135             environment.
136
137
138   ksh
139       The following option is supported by alias:
140
141       -t    Sets and lists tracked aliases.
142
143
144   ksh93
145       The following options are supported by alias:
146
147       -p    Causes the output to be in the form of alias commands that can be
148             used as input to the shell to recreate the current aliases.
149
150
151       -t    Specifies tracked aliases.
152
153             Tracked aliases connect a command name to the command's pathname,
154             and  are  reset  when  the  PATH  variable  is unset. The tracked
155             aliases feature is now obsolete.
156
157
158       -x    Ignored, this option is obsolete.
159
160
161
162       The following option is supported by unalias:
163
164       -a    Causes all alias definitions to be  removed.  name  operands  are
165             optional and ignored if specified.
166
167

OPERANDS

169       The following operands are supported:
170
171   alias
172       alias-name    Write the alias definition to standard output.
173
174
175   unalias
176       alias-name           The name of an alias to be removed.
177
178
179       alias-name=string    Assign  the  value  of  string to the alias alias-
180                            name.
181
182
183
184       If no operands are specified, all  alias  definitions  are  written  to
185       standard output.
186

OUTPUT

188       The  format for displaying aliases (when no operands or only name oper‐
189       ands are specified) is:
190
191         "%s=%s\n" name, value
192
193
194
195
196       The value string is written with appropriate  quoting  so  that  it  is
197       suitable for reinput to the shell.
198

EXAMPLES

200       Example 1 Modifying a Command's Output
201
202
203       This  example specifies that the output of the ls utility is columnated
204       and more annotated:
205
206
207         example% alias ls="ls −CF"
208
209
210
211       Example 2 Repeating Previous Entries in the Command History File
212
213
214       This example creates a simple "redo" command to repeat previous entries
215       in the command history file:
216
217
218         example% alias r='fc −s'
219
220
221
222       Example 3 Specifying a Command's Output Options
223
224
225       This  example  provides  that  the  du utility summarize disk output in
226       units of 1024 bytes:
227
228
229         example% alias du=du −k
230
231
232
233       Example 4 Dealing with an Argument That is an Alias Name
234
235
236       This example sets up the nohup utility so that  it  can  deal  with  an
237       argument that is an alias name:
238
239
240         example% alias nohup="nohup "
241
242
243

ENVIRONMENT VARIABLES

245       See  environ(5) for descriptions of the following environment variables
246       that affect the execution of alias and unalias: LANG, LC_ALL, LC_CTYPE,
247       LC_MESSAGES, and NLSPATH.
248

EXIT STATUS

250       The following exit values are returned:
251
252       0    Successful completion.
253
254
255   alias
256       >0    One  of  the  alias-name operands specified did not have an alias
257             definition, or an error occurred.
258
259
260   unalias
261       >0    One of the alias-name operands  specified  did  not  represent  a
262             valid alias definition, or an error occurred.
263
264

ATTRIBUTES

266       See attributes(5) for descriptions of the following attributes:
267
268   csh, ksh
269       ┌─────────────────────────────┬─────────────────────────────┐
270       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
271       ├─────────────────────────────┼─────────────────────────────┤
272       │Availability                 │SUNWcsu                      │
273       ├─────────────────────────────┼─────────────────────────────┤
274       │Interface Stability          │Committed                    │
275       ├─────────────────────────────┼─────────────────────────────┤
276       │Standard                     │See standards(5).            │
277       └─────────────────────────────┴─────────────────────────────┘
278
279   ksh93
280       ┌─────────────────────────────┬─────────────────────────────┐
281       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
282       ├─────────────────────────────┼─────────────────────────────┤
283       │Availability                 │SUNWcsu                      │
284       ├─────────────────────────────┼─────────────────────────────┤
285       │Interface Stability          │Uncommitted                  │
286       └─────────────────────────────┴─────────────────────────────┘
287

SEE ALSO

289       csh(1), ksh(1), ksh93(1), shell_builtins(1), attributes(5), environ(5),
290       standards(5)
291
292
293
294SunOS 5.11                        8 Apr 2008                          alias(1)
Impressum