CentOS Setup aliases and masking aliases for Linux

Source: Internet
Author: User
Tags aliases

First, the environment

CentOS6.8

Second, set the alias

Alias feature: Highlight the keyword that grep matches

1. Temporary entry into force

[[Email protected] ~] #alias grep= "grep--color=auto"
[[Email protected] ~] #alias//check

2. Permanent entry into force

Method one edit/etc/profile "Effective for all users (permanent)"

[[Email protected] ~] #echo "Alias grep= ' grep--color=auto '" >>/etc/profile
[[Email protected] ~] #tail-1/etc/profile
[[Email protected] ~] #source/etc/profile

Method two edit/ETC/.BASHRC "only valid for the currently logged on user (permanent)"

[[Email protected] ~] #echo "Alias grep= ' grep--color=auto '" >>/.BASHRC
[[Email protected] ~] #tail-1. BASHRC
[[Email protected] ~] #source. BASHRC

Third, the default setting alias brings problems

When a file from the CP or MV in a directory is under another directory, if a file with the same name as the moving file is present in the directory, the user will be prompted to overwrite the file, as the CentOS system has previously configured some command aliases (1-1). If you copy or move files under one directory to another directory, there is a large number of file names that need to be overwritten, which makes the CP or MV command operation extremely cumbersome (1-2).

Figure 1-1

Figure 1-2

Four, the method of blocking aliases

1. Absolute path to command when executing commands

2. "\" symbol in front of the command

CentOS Setup aliases and masking aliases for Linux

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.