Make Alias customizations permanent (+ common aliases) under Linux CentOS

Source: Internet
Author: User
Tags aliases

Alias simplifies complex command strings so that a single word or a simplified command can implement complex (usually long strings with many parameters) commands.


Basic usage:

Alias Simplify command = ' actual long string command '//actual long string command usually ' original command-/option parameter '

eg. Alias Ll= ' Ls-a '


Get aliases:

Alias//To view all alias aliases currently set


To cancel an alias:

Unalias Simplify commands

eg. Unalias ll//Cancel the LL alias


Permanent entry into force:

Aliases defined directly using the alias command are invalidated after a reboot. So if you need to use aliases permanently, you need to do something about it.

modifying/defining aliases is actually the environment variable that defines the system.

The system environment variable file is/etc/profile.

But looking at the profile file, you'll notice that the file starts with a hint:

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/83/4A/wKiom1dveW3iD8cAAABmydfpoWk279.png "title=" Alias.png "alt=" Wkiom1dvew3id8caaabmydfpowk279.png "/>

It is therefore better not to define directly in the/etc/profile file, but to define it in/ETC/BASHRC, and after the definition is complete, make it effective by #source/ETC/BASHRC.

Or, redefine a file/etc/profile.d/alias_bash.sh (Alias_bash file name is arbitrary), and then make it effective by #source/etc/profile.d/alias_bash.

This way, you can make your own (custom) aliases permanent.


Commonly used alias command strings (according to their own habits are very different):

Alias du1= ' du-h--max-depth=1 '//View primary directory usage size (space occupied)

Alias du2= ' du-h--max-depth=2 '//View secondary directory usage size (space occupied)

Alias grep= ' grep--color=auto '//When using grep filtering, highlight filtered characters with default color (string)




(to be added)



Make Alias customizations permanent (+ common aliases) under Linux CentOS

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.