Linux CP/RM/MV Forced overwrite

Source: Internet
Author: User

One, Linux under the CP/RM/MV Force overwrite (a), backslash (\) temporarily de-alias
    [email protected] ~]# \cp filename new/filename       ~]#
(b), Unalias cancel Alias
Note: This is only a temporary cancellation of the CP alias, not Permanent
    CP CP filename new/filename     ~]#       
(iii), modify the default configuration file
    • Enter the alias command to see that the system is using the CP, MV, Rm-i, so how to input are prompt overlay.

[[Email protected] ~]# [[email protected]~]# alias alias CDD='Cd/home/data/android/'aliasCP='cp-i'alias L='Ls-la'alias L.='ls-d. *--color=auto'alias LL='ls-l--color=auto'aliasls='ls--color=auto'aliasMV='mv-i'aliasRM='rm-i'alias TF='tail-f'alias VC='Vim ~/.bash_profile'alias vs='Source ~/.bash_profile'aliaswhich='alias |/usr/bin/which--tty-only--read-alias--SHOW-DOT--show-tilde'
    • Modify the ~/.BASHRC, and then add the ' # ' comment before "alias cp= ' Cp-i '".

[Email protected] test]#VI~/. BASHRC #. BASHRC # User specific aliases and functions aliasRM='rm-i'#aliasCP='cp-i'aliasMV='mv-i'# Source Global Definitionsif[-F/ETC/BASHRC]; Then            . /etc/BASHRCfi
    • Restart or execute source ~/.BASHRC for the command to take effect
(d), yes COMMAND + pipe automatic input Yes
    cp filename new/filename      cp: Overwrite ' new/filename'? [Email protected] ~]#
Second, Java background call Linux command implementation
  Public voidCopyicon ()throwsIOException, interruptedexception {Runtime R=Runtime.getruntime (); String cmd_copy= "\\cp-rf temp/appicon/* icon/";//Copy and Overwritestring[] Cmds =Newstring[]{"sh", "-C", cmd_copy}; Process P=r.exec (CMDS); intresult =p.waitfor (); if(result = = 0) {//indicates a normal endLogger.error ("Copy appIcon Success" "); }Else{logger.error ("Copy AppIcon failed" "+cmd_copy); }      }

Linux CP/RM/MV Forced overwrite

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.