O'Reilly logo

Practical Linux by Bill Ball, John Ray, Michael Turner, M. Drew Streib

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

Creating Aliases

Aliases are redefinitions of commands, usually in shortened form. Systemwide alias definitions are entered by the root operator in the bashrc file under the /etc directory, but you can define your own in your .bashrc file. Several of these aliases are especially useful:

alias cp='cp -i'
alias mv='mv -i'
alias rm='rm -i'
alias ls='ls --color=auto'

In this example you are redefining the default action of the cp, mv, and rm commands to use interactive querying, which provides a measure of safety when copying, deleting, moving, or renaming files. Aliases can also be used to craft new commands or variations of often-used commands and command-line options, such as redefining ls to use color by default.

In a more detailed example you ...

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