1 ALIAS(1)                         User Commands                        ALIAS(1)
   2 
   3 
   4 
   5 NAME
   6        alias, unalias - create or remove a pseudonym or shorthand for a
   7        command or series of commands
   8 
   9 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    ksh93
  27        alias [-ptx] [name[= value]...]
  28 
  29 
  30        unalias [-a] [name...]
  31 
  32 
  33 DESCRIPTION
  34        The alias and unalias utilities create or remove a pseudonym or
  35        shorthand term for a command or series of commands, with different
  36        functionality in the C-shell and Korn shell environments.
  37 
  38    /usr/bin/alias
  39        The alias utility creates or redefines alias definitions or writes the
  40        values of existing alias definitions to standard output. An alias
  41        definition provides a string value that replaces a command name when it
  42        is encountered.
  43 
  44 
  45        An alias definition affects the current shell execution environment and
  46        the execution environments of the subshells of the current shell. When
  47        used as specified by this document, the alias definition does not
  48        affect the parent process of the current shell nor any utility
  49        environment invoked by the shell.
  50 
  51    /usr/bin/unalias
  52        The unalias utility removes the definition for each alias name
  53        specified.  The aliases are removed from the current shell execution
  54        environment. The -a option removes all alias definitions from the
  55        current execution environment.
  56 
  57    csh
  58        alias assigns def to the alias name. The assigned def is a list of
  59        words that can contain escaped history-substitution metasyntax.  name
  60        is not allowed to be alias or unalias. If def is omitted, the alias
  61        name is displayed along with its current definition.  If both name and
  62        def are omitted, all aliases are displayed.
  63 
  64 
  65        Because of implementation restrictions, an alias definition must have
  66        been entered on a previous command line before it can be used.
  67 
  68 
  69        unalias discards aliases that match (filename substitution) pattern.
  70        All aliases can be removed by `unalias *'.
  71 
  72    ksh93
  73        alias creates or redefines alias definitions or writes the existing
  74        alias definitions to standard output.
  75 
  76 
  77        An alias definition provides a string value that replaces a command
  78        name when the command is read. Alias names can contain any printable
  79        character that is not special to the shell. If an alias value ends in a
  80        SPACE or TAB, the word following the command name the alias replaces is
  81        also checked to see whether it is an alias.
  82 
  83 
  84        If no names are specified, the names and values of all aliases are
  85        written to standard output. Otherwise, for each name that is specified,
  86        and =value is not specified, the current value of the alias
  87        corresponding to name is written to standard output. If =value is
  88        specified, the alias name is created or redefined.
  89 
  90 
  91        alias is built-in to the shell as a declaration command so that field
  92        splitting and pathname expansion are not performed on the arguments.
  93        Tilde expansion occurs on value. An alias definition only affects
  94        scripts read by the current shell environment. It does not affect
  95        scripts run by this shell.
  96 
  97 
  98        unalias removes the definition of each named alias from the current
  99        shell execution environment, or all aliases if -a is specified. It does
 100        not affect any commands that have already been read and subsequently
 101        executed.
 102 
 103 OPTIONS
 104        The following option is supported by unalias:
 105 
 106        -a
 107              Removes all alias definitions from the current shell execution
 108              environment.
 109 
 110 
 111    ksh93
 112        The following options are supported by alias:
 113 
 114        -p
 115              Causes the output to be in the form of alias commands that can be
 116              used as input to the shell to recreate the current aliases.
 117 
 118 
 119        -t
 120              Specifies tracked aliases.
 121 
 122              Tracked aliases connect a command name to the command's pathname,
 123              and are reset when the PATH variable is unset. The tracked
 124              aliases feature is now obsolete.
 125 
 126 
 127        -x
 128              Ignored, this option is obsolete.
 129 
 130 
 131 
 132        The following option is supported by unalias:
 133 
 134        -a
 135              Causes all alias definitions to be removed. name operands are
 136              optional and ignored if specified.
 137 
 138 
 139 OPERANDS
 140        The following operands are supported:
 141 
 142    alias
 143        alias-name
 144                      Write the alias definition to standard output.
 145 
 146 
 147    unalias
 148        alias-name
 149                             The name of an alias to be removed.
 150 
 151 
 152        alias-name=string
 153                             Assign the value of string to the alias alias-
 154                             name.
 155 
 156 
 157 
 158        If no operands are specified, all alias definitions are written to
 159        standard output.
 160 
 161 OUTPUT
 162        The format for displaying aliases (when no operands or only name
 163        operands are specified) is:
 164 
 165          "%s=%s\n" name, value
 166 
 167 
 168 
 169 
 170        The value string is written with appropriate quoting so that it is
 171        suitable for reinput to the shell.
 172 
 173 EXAMPLES
 174        Example 1 Modifying a Command's Output
 175 
 176 
 177        This example specifies that the output of the ls utility is columnated
 178        and more annotated:
 179 
 180 
 181          example% alias ls="ls -CF"
 182 
 183 
 184 
 185        Example 2 Repeating Previous Entries in the Command History File
 186 
 187 
 188        This example creates a simple "redo" command to repeat previous entries
 189        in the command history file:
 190 
 191 
 192          example% alias r='fc -s'
 193 
 194 
 195 
 196        Example 3 Specifying a Command's Output Options
 197 
 198 
 199        This example provides that the du utility summarize disk output in
 200        units of 1024 bytes:
 201 
 202 
 203          example% alias du=du -k
 204 
 205 
 206 
 207        Example 4 Dealing with an Argument That is an Alias Name
 208 
 209 
 210        This example sets up the nohup utility so that it can deal with an
 211        argument that is an alias name:
 212 
 213 
 214          example% alias nohup="nohup "
 215 
 216 
 217 
 218 ENVIRONMENT VARIABLES
 219        See environ(5) for descriptions of the following environment variables
 220        that affect the execution of alias and unalias: LANG, LC_ALL, LC_CTYPE,
 221        LC_MESSAGES, and NLSPATH.
 222 
 223 EXIT STATUS
 224        The following exit values are returned:
 225 
 226        0
 227             Successful completion.
 228 
 229 
 230    alias
 231        >0
 232              One of the alias-name operands specified did not have an alias
 233              definition, or an error occurred.
 234 
 235 
 236    unalias
 237        >0
 238              One of the alias-name operands specified did not represent a
 239              valid alias definition, or an error occurred.
 240 
 241 
 242 ATTRIBUTES
 243        See attributes(5) for descriptions of the following attributes:
 244 
 245    csh, ksh
 246 
 247        +--------------------+-------------------+
 248        |  ATTRIBUTE TYPE    |  ATTRIBUTE VALUE  |
 249        +--------------------+-------------------+
 250        |Interface Stability | Committed         |
 251        +--------------------+-------------------+
 252        |Standard            | See standards(5). |
 253        +--------------------+-------------------+
 254 
 255    ksh93
 256 
 257        +--------------------+-----------------+
 258        |  ATTRIBUTE TYPE    | ATTRIBUTE VALUE |
 259        +--------------------+-----------------+
 260        |Interface Stability | Uncommitted     |
 261        +--------------------+-----------------+
 262 
 263 SEE ALSO
 264        csh(1), ksh(1), ksh93(1), shell_builtins(1), attributes(5), environ(5),
 265        standards(5)
 266 
 267 
 268 
 269                                February 9, 2021                       ALIAS(1)