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)