Linux-31-linux Basic Important Command 08-(L005-13)

Source: Internet
Author: User
Tags aliases

Example : The Test.txt file already exists in the/tmp directory, how to execute the command to copy the/mnt/test.txt to/tmp and overwrite the/tmp/ Test.txt the Linux system without prompting for overrides (root privileges).

Answer:

First create the/tmp directory with the Test.txt file,




Create the/mnt directory with the Test.txt file,




If you use the CP command to copy the Test.txt file in the/tmp directory to the/MNT directory, you will be prompted to




What can I do now to cover it directly? Without this hint?

Method One: Add \ Can before the command, such as:\cp /tmp/test.txt/mnt command,




Method Two: First use the which command to see where the CP command is located,




Found in the bin directory, then the full path of the command can be directly copied overwrite, skip the hint,




Method Three (not normally used): first look at aliases with the alias command,




Find the CP command is cp= ' Cp–i ', where-i is one more step confirmation information, are you sure to overwrite it? Then we use the unalias CP command to remove the alias of the CP (just temporarily delete, restart the server and securecrt again),




Then directly with the CP command,




The role of aliases:

( 1 by adding some protection parameters to the dangerous command to prevent human error operation;

( 2 make a lot of complex strings or commands into a simple string;

Custom aliases, note the command :




Verify that your custom alias is successful



Linux-31-linux Basic Important Command 08-(L005-13)

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.