O'Reilly logo

Linux in a Nutshell, Fourth Edition by Aaron Weber, Stephen Figgins, Ellen Siever

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

alias

Synopsis

                  alias [name [command]]

Assign name as the shorthand name, or alias, for command. If command is omitted, print the alias for name; if name also is omitted, print all aliases. Aliases can be defined on the command line, but more often they are stored in .tcshrc so that they take effect upon logging in. (See the sample .tcshrc file earlier in this chapter.) Alias definitions can reference command-line arguments, much like the history list. Use \!* to refer to all command-line arguments, \!^ for the first argument, \!\!:2 for the second, \!$ for the last, and so on. An alias name can be any valid Unix command except alias or unalias; however, you lose the original command’s meaning unless you type \name. See also unalias and Section 8.6.7.

Examples

Set the size for windows under the X Window System:

                  alias R 'set noglob; eval `resize` unset noglob'

Show aliases that contain the string ls:

                  alias | grep ls

Run nroff on all command-line arguments:

                  alias ms 'nroff -ms \!*'

Copy the file that is named as the first argument:

                  alias back 'cp \!^ \!^.old'

Use the regular ls, not its alias:

% \ls

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required