Problems with CentOS Linux due to aliasing issues and solutions

Source: Internet
Author: User
Tags aliases

The old boy-share in the L005-13 section of phase 19. Organize yourself and send it to your micro blog to stay in the file.

Original: http://oldboy.blog.51cto.com/2561410/699046

example: Old boy Linux Combat Training First 9 Period ( Ten Month A Day ) Entrance Examination question No. Ten Title:

10. It is known that the Test.txt file already exists in/tmp, how to execute the command to overwrite the/mnt/test.txt/tmp/test.txt and let the system not prompt for overwrite (root permission).

To prevent user misuse, the CentOS Linux operating system is designed to perform the default operation of the CP by calling the CP alias (equivalent to executing cp-i). So tip overlay. The idea of this problem is to block out the system aliases.

Detailed Description:

The CP command will not be overwritten by default, but the CP band-I parameter will prompt when it executes, and the Linux startup file ~/.BASHRC will name the CP as alias cp= ' cp-i ' such as:

[[email protected] tmp]# alias |grep CP

Alias cp= ' Cp-i '

The actual test (although the specification is still in-depth study after validation, as an alternative method)

[[email protected] tmp]# alias CP

Also shown as alias cp= ' Cp-i '

In this way, the input CP command in Linux is actually running cp-i, plus a "\", a symbol or a write CP full path/BIN/CP is to let the CP command do not use Alias (Cp-i) to run.

Here is the use of alias and Unalias two commands, and we also think about the benefits of aliases and how to use this feature to serve us.

Some special methods:

[[email protected] ~]# alias rm= ' echo ' RM does not allow to be exec "'

This method can confuse a person who has not used this server, and using RM will prompt RM not to be executed.

When you use it in front of the root path, such as/BIN/RM can be used or \RM, specifically see above. However, this method of server restart after the failure, the permanent words to see above.

Add the following:

For example, it is often necessary to execute a long command, which can be defined by an alias.

Alias oldboy= ' Cat Etc/sysconfig/network-scripts/ifcfg-eth0 ' (view NIC)

You can then enter Oldboy directly to execute the Cat etc/sysconfig/network-scripts/ifcfg-eth0 command, which is very convenient.

Problems with CentOS Linux due to aliasing issues and solutions

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.