Name

alias

Synopsis

alias [option] [name[='cmd']...]

Assign a shorthand name as a synonym for cmd. If ='cmd' is omitted, print the alias for name; if name is also omitted, print all aliases. By itself or with -p, alias prints one alias per line on standard output as alias name=value. If the value contains a trailing space, the next word on the command line also becomes a candidate for alias expansion. See also unalias.

Option

-p

Print the word alias before each alias.

Example

alias dir='echo ${PWD##*/}'

Get Linux in a Nutshell, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.