27 .\" The contents of this file are subject to the terms of the
28 .\" Common Development and Distribution License (the "License").
29 .\" You may not use this file except in compliance with the License.
30 .\"
31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 .\" or http://www.opensolaris.org/os/licensing.
33 .\" See the License for the specific language governing permissions
34 .\" and limitations under the License.
35 .\"
36 .\" When distributing Covered Code, include this CDDL HEADER in each
37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38 .\" If applicable, add the following below this CDDL HEADER, with the
39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
41 .\"
42 .\"
43 .\" Copyright 1989 AT&T
44 .\" Portions Copyright (c) 1992, X/Open Company Limited. All Rights Reserved.
45 .\" Portions Copyright (c) 1982-2007 AT&T Knowledge Ventures
46 .\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
47 .\"
48 .TH ALIAS 1 "Apr 8, 2008"
49 .SH NAME
50 alias, unalias \- create or remove a pseudonym or shorthand for a command or
51 series of commands
52 .SH SYNOPSIS
53 .LP
54 .nf
55 \fB/usr/bin/alias\fR [\fIalias-name\fR[= \fIstring\fR...]]
56 .fi
57
58 .LP
59 .nf
60 \fB/usr/bin/unalias\fR \fIalias-name\fR...
61 .fi
62
63 .LP
64 .nf
65 \fB/usr/bin/unalias\fR \fB-a\fR
66 .fi
67
68 .SS "\fBcsh\fR"
69 .LP
70 .nf
71 \fBalias\fR [\fIname\fR [\fIdef\fR]]
72 .fi
73
74 .LP
75 .nf
76 \fBunalias\fR \fIpattern\fR
77 .fi
78
79 .SS "\fBksh\fR"
80 .LP
81 .nf
82 \fBalias\fR [\fB-tx\fR] [\fIname\fR[= \fIvalue\fR]...]
83 .fi
84
85 .LP
86 .nf
87 \fBunalias\fR \fIname\fR...
88 .fi
89
90 .LP
91 .nf
92 \fBunalias\fR [\fB-a\fR]
93 .fi
94
95 .SS "\fBksh93\fR"
96 .LP
97 .nf
98 \fBalias\fR [\fB-ptx\fR] [\fIname\fR[= \fIvalue\fR]...]
99 .fi
100
101 .LP
102 .nf
103 \fBunalias\fR [\fB-a\fR] [\fIname\fR...]
104 .fi
105
106 .SH DESCRIPTION
107 .sp
108 .LP
109 The \fBalias\fR and \fBunalias\fR utilities create or remove a pseudonym or
110 shorthand term for a command or series of commands, with different
111 functionality in the C-shell and Korn shell environments.
112 .SS "\fB/usr/bin/alias\fR"
113 .sp
114 .LP
115 The \fBalias\fR utility creates or redefines alias definitions or writes the
116 values of existing alias definitions to standard output. An alias definition
117 provides a string value that replaces a command name when it is encountered.
118 .sp
119 .LP
120 An alias definition affects the current shell execution environment and the
121 execution environments of the subshells of the current shell. When used as
122 specified by this document, the alias definition does not affect the parent
123 process of the current shell nor any utility environment invoked by the shell.
124 .SS "\fB/usr/bin/unalias\fR"
125 .sp
126 .LP
127 The \fBunalias\fR utility removes the definition for each alias name specified.
128 The aliases are removed from the current shell execution environment. The
129 \fB-a\fR option removes all alias definitions from the current execution
130 environment.
131 .SS "\fBcsh\fR"
132 .sp
133 .LP
134 \fBalias\fR assigns \fIdef\fR to the alias \fIname\fR. The assigned \fIdef\fR
135 is a list of words that can contain escaped history-substitution metasyntax.
136 \fIname\fR is not allowed to be \fBalias\fR or \fBunalias\fR. If \fIdef\fR is
137 omitted, the alias \fIname\fR is displayed along with its current definition.
138 If both \fIname\fR and \fIdef\fR are omitted, all aliases are displayed.
139 .sp
140 .LP
141 Because of implementation restrictions, an alias definition must have been
142 entered on a previous command line before it can be used.
143 .sp
144 .LP
145 \fBunalias\fR discards aliases that match (filename substitution)
146 \fIpattern\fR. All aliases can be removed by `\fBunalias *\fR'.
147 .SS "\fBksh\fR"
148 .sp
149 .LP
150 \fBalias\fR with no arguments prints the list of aliases in the form
151 \fIname=value\fR on standard output. An \fBalias\fR is defined for each name
152 whose \fIvalue\fR is specified. A trailing space in \fIvalue\fR causes the next
153 word to be checked for alias substitution. The \fB-t\fR flag is used to set and
154 list tracked aliases. The value of a tracked alias is the full pathname
155 corresponding to the specified \fIname\fR. The value becomes undefined when the
156 value of \fBPATH\fR is reset but the aliases remained tracked. Without the
157 \fB-t\fR flag, for each \fIname\fR in the argument list for which no
158 \fIvalue\fR is specified, the name and value of the alias is printed. The
159 \fB-x\fR flag is used to set or print \fIexported alias\fRes. An exported alias
160 is defined for scripts invoked by \fIname\fR. The exit status is non-zero if a
161 \fIname\fR is specified, but no value, and no alias has been defined for the
162 \fIname\fR.
163 .sp
164 .LP
165 The \fBalias\fRs specified by the list of \fIname\fRs can be removed from the
166 \fBalias\fR list with \fBunalias\fR.
167 .SS "\fBksh93\fR"
168 .sp
169 .LP
170 \fBalias\fR creates or redefines alias definitions or writes the existing alias
171 definitions to standard output.
172 .sp
173 .LP
174 An alias definition provides a string value that replaces a command name when
175 the command is read. Alias names can contain any printable character that is
176 not special to the shell. If an alias value ends in a SPACE or TAB, the word
177 following the command name the alias replaces is also checked to see whether it
178 is an alias.
179 .sp
180 .LP
181 If no names are specified, the names and values of all aliases are written to
182 standard output. Otherwise, for each name that is specified, and
183 \fB=\fR\fIvalue\fR is not specified, the current value of the alias
184 corresponding to name is written to standard output. If \fB=\fR\fIvalue\fR is
185 specified, the alias name is created or redefined.
186 .sp
187 .LP
188 \fBalias\fR is built-in to the shell as a declaration command so that field
189 splitting and pathname expansion are not performed on the arguments. Tilde
190 expansion occurs on \fIvalue\fR. An alias definition only affects scripts read
191 by the current shell environment. It does not affect scripts run by this shell.
192 .sp
193 .LP
194 \fBunalias\fR removes the definition of each named alias from the current shell
195 execution environment, or all aliases if \fB-a\fR is specified. It does not
196 affect any commands that have already been read and subsequently executed.
197 .SH OPTIONS
198 .sp
199 .LP
200 The following option is supported by \fBunalias\fR:
201 .sp
202 .ne 2
203 .na
204 \fB\fB-a\fR\fR
205 .ad
206 .RS 6n
207 Removes all alias definitions from the current shell execution environment.
208 .RE
209
210 .SS "\fBksh\fR"
211 .sp
212 .LP
213 The following option is supported by \fBalias\fR:
214 .sp
215 .ne 2
216 .na
217 \fB\fB-t\fR\fR
218 .ad
219 .RS 6n
220 Sets and lists tracked aliases.
221 .RE
222
223 .SS "\fBksh93\fR"
224 .sp
225 .LP
226 The following options are supported by \fBalias\fR:
227 .sp
228 .ne 2
229 .na
230 \fB\fB-p\fR\fR
231 .ad
232 .RS 6n
233 Causes the output to be in the form of \fBalias\fR commands that can be used as
234 input to the shell to recreate the current aliases.
235 .RE
236
237 .sp
238 .ne 2
239 .na
240 \fB\fB-t\fR\fR
241 .ad
242 .RS 6n
243 Specifies tracked aliases.
244 .sp
245 Tracked aliases connect a command name to the command's pathname, and are reset
253 \fB\fB-x\fR\fR
254 .ad
255 .RS 6n
256 Ignored, this option is obsolete.
257 .RE
258
259 .sp
260 .LP
261 The following option is supported by \fBunalias\fR:
262 .sp
263 .ne 2
264 .na
265 \fB\fB-a\fR\fR
266 .ad
267 .RS 6n
268 Causes all alias definitions to be removed. \fIname\fR operands are optional
269 and ignored if specified.
270 .RE
271
272 .SH OPERANDS
273 .sp
274 .LP
275 The following operands are supported:
276 .SS "\fBalias\fR"
277 .sp
278 .ne 2
279 .na
280 \fB\fIalias-name\fR\fR
281 .ad
282 .RS 14n
283 Write the alias definition to standard output.
284 .RE
285
286 .SS "\fBunalias\fR"
287 .sp
288 .ne 2
289 .na
290 \fB\fIalias-name\fR\fR
291 .ad
292 .RS 21n
293 The name of an alias to be removed.
294 .RE
295
296 .sp
297 .ne 2
298 .na
299 \fB\fIalias-name\fR\fB=\fR\fIstring\fR\fR
300 .ad
301 .RS 21n
302 Assign the value of \fIstring\fR to the alias \fIalias-name\fR.
303 .RE
304
305 .sp
306 .LP
307 If no operands are specified, all alias definitions are written to standard
308 output.
309 .SH OUTPUT
310 .sp
311 .LP
312 The format for displaying aliases (when no operands or only \fIname\fR operands
313 are specified) is:
314 .sp
315 .in +2
316 .nf
317 "%s=%s\en" \fIname\fR, \fIvalue\fR
318 .fi
319 .in -2
320 .sp
321
322 .sp
323 .LP
324 The \fIvalue\fR string is written with appropriate quoting so that it is
325 suitable for reinput to the shell.
326 .SH EXAMPLES
327 .LP
328 \fBExample 1 \fRModifying a Command's Output
329 .sp
330 .LP
331 This example specifies that the output of the \fBls\fR utility is columnated
332 and more annotated:
333
334 .sp
335 .in +2
336 .nf
337 example% \fBalias ls="ls \(miCF"\fR
338 .fi
339 .in -2
340 .sp
341
342 .LP
343 \fBExample 2 \fRRepeating Previous Entries in the Command History File
344 .sp
345 .LP
346 This example creates a simple "redo" command to repeat previous entries in the
347 command history file:
368 .fi
369 .in -2
370 .sp
371
372 .LP
373 \fBExample 4 \fRDealing with an Argument That is an Alias Name
374 .sp
375 .LP
376 This example sets up the \fBnohup\fR utility so that it can deal with an
377 argument that is an alias name:
378
379 .sp
380 .in +2
381 .nf
382 example% \fBalias nohup="nohup "\fR
383 .fi
384 .in -2
385 .sp
386
387 .SH ENVIRONMENT VARIABLES
388 .sp
389 .LP
390 See \fBenviron\fR(5) for descriptions of the following environment variables
391 that affect the execution of \fBalias\fR and \fBunalias\fR: \fBLANG\fR,
392 \fBLC_ALL\fR, \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
393 .SH EXIT STATUS
394 .sp
395 .LP
396 The following exit values are returned:
397 .sp
398 .ne 2
399 .na
400 \fB\fB0\fR\fR
401 .ad
402 .RS 5n
403 Successful completion.
404 .RE
405
406 .SS "\fBalias\fR"
407 .sp
408 .ne 2
409 .na
410 \fB\fB>0\fR\fR
411 .ad
412 .RS 6n
413 One of the \fIalias-name\fR operands specified did not have an alias
414 definition, or an error occurred.
415 .RE
416
417 .SS "\fBunalias\fR"
418 .sp
419 .ne 2
420 .na
421 \fB\fB>0\fR\fR
422 .ad
423 .RS 6n
424 One of the \fIalias-name\fR operands specified did not represent a valid alias
425 definition, or an error occurred.
426 .RE
427
428 .SH ATTRIBUTES
429 .sp
430 .LP
431 See \fBattributes\fR(5) for descriptions of the following attributes:
432 .SS "\fBcsh, ksh\fR"
433 .sp
434
435 .sp
436 .TS
437 box;
438 c | c
439 l | l .
440 ATTRIBUTE TYPE ATTRIBUTE VALUE
441 _
442 Interface Stability Committed
443 _
444 Standard See \fBstandards\fR(5).
445 .TE
446
447 .SS "\fBksh93\fR"
448 .sp
449
450 .sp
451 .TS
452 box;
453 c | c
454 l | l .
455 ATTRIBUTE TYPE ATTRIBUTE VALUE
456 _
457 Interface Stability Uncommitted
458 .TE
459
460 .SH SEE ALSO
461 .sp
462 .LP
463 \fBcsh\fR(1), \fBksh\fR(1), \fBksh93\fR(1), \fBshell_builtins\fR(1),
464 \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5)
|
27 .\" The contents of this file are subject to the terms of the
28 .\" Common Development and Distribution License (the "License").
29 .\" You may not use this file except in compliance with the License.
30 .\"
31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 .\" or http://www.opensolaris.org/os/licensing.
33 .\" See the License for the specific language governing permissions
34 .\" and limitations under the License.
35 .\"
36 .\" When distributing Covered Code, include this CDDL HEADER in each
37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38 .\" If applicable, add the following below this CDDL HEADER, with the
39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
41 .\"
42 .\"
43 .\" Copyright 1989 AT&T
44 .\" Portions Copyright (c) 1992, X/Open Company Limited. All Rights Reserved.
45 .\" Portions Copyright (c) 1982-2007 AT&T Knowledge Ventures
46 .\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
47 .\" Copyright 2021 OmniOS Community Edition (OmniOSce) Association.
48 .\"
49 .TH ALIAS 1 "Feb 9, 2021"
50 .SH NAME
51 alias, unalias \- create or remove a pseudonym or shorthand for a command or
52 series of commands
53 .SH SYNOPSIS
54 .nf
55 \fB/usr/bin/alias\fR [\fIalias-name\fR[= \fIstring\fR...]]
56 .fi
57
58 .LP
59 .nf
60 \fB/usr/bin/unalias\fR \fIalias-name\fR...
61 .fi
62
63 .LP
64 .nf
65 \fB/usr/bin/unalias\fR \fB-a\fR
66 .fi
67
68 .SS "\fBcsh\fR"
69 .nf
70 \fBalias\fR [\fIname\fR [\fIdef\fR]]
71 .fi
72
73 .LP
74 .nf
75 \fBunalias\fR \fIpattern\fR
76 .fi
77
78 .SS "\fBksh93\fR"
79 .nf
80 \fBalias\fR [\fB-ptx\fR] [\fIname\fR[= \fIvalue\fR]...]
81 .fi
82
83 .LP
84 .nf
85 \fBunalias\fR [\fB-a\fR] [\fIname\fR...]
86 .fi
87
88 .SH DESCRIPTION
89 The \fBalias\fR and \fBunalias\fR utilities create or remove a pseudonym or
90 shorthand term for a command or series of commands, with different
91 functionality in the C-shell and Korn shell environments.
92 .SS "\fB/usr/bin/alias\fR"
93 The \fBalias\fR utility creates or redefines alias definitions or writes the
94 values of existing alias definitions to standard output. An alias definition
95 provides a string value that replaces a command name when it is encountered.
96 .sp
97 .LP
98 An alias definition affects the current shell execution environment and the
99 execution environments of the subshells of the current shell. When used as
100 specified by this document, the alias definition does not affect the parent
101 process of the current shell nor any utility environment invoked by the shell.
102 .SS "\fB/usr/bin/unalias\fR"
103 The \fBunalias\fR utility removes the definition for each alias name specified.
104 The aliases are removed from the current shell execution environment. The
105 \fB-a\fR option removes all alias definitions from the current execution
106 environment.
107 .SS "\fBcsh\fR"
108 \fBalias\fR assigns \fIdef\fR to the alias \fIname\fR. The assigned \fIdef\fR
109 is a list of words that can contain escaped history-substitution metasyntax.
110 \fIname\fR is not allowed to be \fBalias\fR or \fBunalias\fR. If \fIdef\fR is
111 omitted, the alias \fIname\fR is displayed along with its current definition.
112 If both \fIname\fR and \fIdef\fR are omitted, all aliases are displayed.
113 .sp
114 .LP
115 Because of implementation restrictions, an alias definition must have been
116 entered on a previous command line before it can be used.
117 .sp
118 .LP
119 \fBunalias\fR discards aliases that match (filename substitution)
120 \fIpattern\fR. All aliases can be removed by `\fBunalias *\fR'.
121 .SS "\fBksh93\fR"
122 \fBalias\fR creates or redefines alias definitions or writes the existing alias
123 definitions to standard output.
124 .sp
125 .LP
126 An alias definition provides a string value that replaces a command name when
127 the command is read. Alias names can contain any printable character that is
128 not special to the shell. If an alias value ends in a SPACE or TAB, the word
129 following the command name the alias replaces is also checked to see whether it
130 is an alias.
131 .sp
132 .LP
133 If no names are specified, the names and values of all aliases are written to
134 standard output. Otherwise, for each name that is specified, and
135 \fB=\fR\fIvalue\fR is not specified, the current value of the alias
136 corresponding to name is written to standard output. If \fB=\fR\fIvalue\fR is
137 specified, the alias name is created or redefined.
138 .sp
139 .LP
140 \fBalias\fR is built-in to the shell as a declaration command so that field
141 splitting and pathname expansion are not performed on the arguments. Tilde
142 expansion occurs on \fIvalue\fR. An alias definition only affects scripts read
143 by the current shell environment. It does not affect scripts run by this shell.
144 .sp
145 .LP
146 \fBunalias\fR removes the definition of each named alias from the current shell
147 execution environment, or all aliases if \fB-a\fR is specified. It does not
148 affect any commands that have already been read and subsequently executed.
149 .SH OPTIONS
150 The following option is supported by \fBunalias\fR:
151 .sp
152 .ne 2
153 .na
154 \fB\fB-a\fR\fR
155 .ad
156 .RS 6n
157 Removes all alias definitions from the current shell execution environment.
158 .RE
159
160 .SS "\fBksh93\fR"
161 The following options are supported by \fBalias\fR:
162 .sp
163 .ne 2
164 .na
165 \fB\fB-p\fR\fR
166 .ad
167 .RS 6n
168 Causes the output to be in the form of \fBalias\fR commands that can be used as
169 input to the shell to recreate the current aliases.
170 .RE
171
172 .sp
173 .ne 2
174 .na
175 \fB\fB-t\fR\fR
176 .ad
177 .RS 6n
178 Specifies tracked aliases.
179 .sp
180 Tracked aliases connect a command name to the command's pathname, and are reset
188 \fB\fB-x\fR\fR
189 .ad
190 .RS 6n
191 Ignored, this option is obsolete.
192 .RE
193
194 .sp
195 .LP
196 The following option is supported by \fBunalias\fR:
197 .sp
198 .ne 2
199 .na
200 \fB\fB-a\fR\fR
201 .ad
202 .RS 6n
203 Causes all alias definitions to be removed. \fIname\fR operands are optional
204 and ignored if specified.
205 .RE
206
207 .SH OPERANDS
208 The following operands are supported:
209 .SS "\fBalias\fR"
210 .ne 2
211 .na
212 \fB\fIalias-name\fR\fR
213 .ad
214 .RS 14n
215 Write the alias definition to standard output.
216 .RE
217
218 .SS "\fBunalias\fR"
219 .ne 2
220 .na
221 \fB\fIalias-name\fR\fR
222 .ad
223 .RS 21n
224 The name of an alias to be removed.
225 .RE
226
227 .sp
228 .ne 2
229 .na
230 \fB\fIalias-name\fR\fB=\fR\fIstring\fR\fR
231 .ad
232 .RS 21n
233 Assign the value of \fIstring\fR to the alias \fIalias-name\fR.
234 .RE
235
236 .sp
237 .LP
238 If no operands are specified, all alias definitions are written to standard
239 output.
240 .SH OUTPUT
241 The format for displaying aliases (when no operands or only \fIname\fR operands
242 are specified) is:
243 .sp
244 .in +2
245 .nf
246 "%s=%s\en" \fIname\fR, \fIvalue\fR
247 .fi
248 .in -2
249 .sp
250
251 .sp
252 .LP
253 The \fIvalue\fR string is written with appropriate quoting so that it is
254 suitable for reinput to the shell.
255 .SH EXAMPLES
256 \fBExample 1 \fRModifying a Command's Output
257 .sp
258 .LP
259 This example specifies that the output of the \fBls\fR utility is columnated
260 and more annotated:
261
262 .sp
263 .in +2
264 .nf
265 example% \fBalias ls="ls \(miCF"\fR
266 .fi
267 .in -2
268 .sp
269
270 .LP
271 \fBExample 2 \fRRepeating Previous Entries in the Command History File
272 .sp
273 .LP
274 This example creates a simple "redo" command to repeat previous entries in the
275 command history file:
296 .fi
297 .in -2
298 .sp
299
300 .LP
301 \fBExample 4 \fRDealing with an Argument That is an Alias Name
302 .sp
303 .LP
304 This example sets up the \fBnohup\fR utility so that it can deal with an
305 argument that is an alias name:
306
307 .sp
308 .in +2
309 .nf
310 example% \fBalias nohup="nohup "\fR
311 .fi
312 .in -2
313 .sp
314
315 .SH ENVIRONMENT VARIABLES
316 See \fBenviron\fR(5) for descriptions of the following environment variables
317 that affect the execution of \fBalias\fR and \fBunalias\fR: \fBLANG\fR,
318 \fBLC_ALL\fR, \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
319 .SH EXIT STATUS
320 The following exit values are returned:
321 .sp
322 .ne 2
323 .na
324 \fB\fB0\fR\fR
325 .ad
326 .RS 5n
327 Successful completion.
328 .RE
329
330 .SS "\fBalias\fR"
331 .ne 2
332 .na
333 \fB\fB>0\fR\fR
334 .ad
335 .RS 6n
336 One of the \fIalias-name\fR operands specified did not have an alias
337 definition, or an error occurred.
338 .RE
339
340 .SS "\fBunalias\fR"
341 .ne 2
342 .na
343 \fB\fB>0\fR\fR
344 .ad
345 .RS 6n
346 One of the \fIalias-name\fR operands specified did not represent a valid alias
347 definition, or an error occurred.
348 .RE
349
350 .SH ATTRIBUTES
351 See \fBattributes\fR(5) for descriptions of the following attributes:
352 .SS "\fBcsh, ksh\fR"
353 .TS
354 box;
355 c | c
356 l | l .
357 ATTRIBUTE TYPE ATTRIBUTE VALUE
358 _
359 Interface Stability Committed
360 _
361 Standard See \fBstandards\fR(5).
362 .TE
363
364 .SS "\fBksh93\fR"
365 .TS
366 box;
367 c | c
368 l | l .
369 ATTRIBUTE TYPE ATTRIBUTE VALUE
370 _
371 Interface Stability Uncommitted
372 .TE
373
374 .SH SEE ALSO
375 \fBcsh\fR(1), \fBksh\fR(1), \fBksh93\fR(1), \fBshell_builtins\fR(1),
376 \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5)
|