Linux MV Command

Source: Internet
Author: User

MV--Move
    1. In the same directory, the equivalent of changing the name

[[email protected] ~]# Lsanaconda-ks.cfg[[email protected] ~]# mv anaconda-ks.cfg Anaconda-ks.cfg.1[[email protected] ~] # Lsanaconda-ks.cfg.1
    1. In different directories, it is the mobile location.

Move and change the name

[[email protected] tmp]# ls1.txt  allin  allin1  ls2   systemd-private-a8472426664940399000bf05f5b4a2c8-vmtoolsd.service-ceavag[[email protected] tmp]#  mv 1.txt  /root/2.txt[[email protected] tmp]# ls allin   allin1  ls2  systemd-private-a8472426664940399000bf05f5b4a2c8-vmtoolsd.service-ceavag[[ Email protected] tmp]# ls /root/2.txt  anaconda-ks.cfg.1 

move only

[[email protected] tmp]# ls /root/2.txt  anaconda-ks.cfg.1[[email  Protected] tmp]# mv /root/2.txt  /tmp/[[email protected] tmp]# ls  2.txt  allin  allin1  ls2   Systemd-private-a8472426664940399000bf05f5b4a2c8-vmtoolsd.service-ceavag 

Overwrite hint, because alias is visible and comes with -i security options

[email protected] tmp]# which Mvalias mv= ' mv-i '/USR/BIN/MV
[[email protected] tmp]# ls 2.txt  allin  allin1  ls2   systemd-private-a8472426664940399000bf05f5b4a2c8-vmtoolsd.service-ceavag[[email protected] tmp ]# mv ls2 allin/[[email protected] tmp]# touch ls2[[email protected]  TMP]# MV LS2 ALLIN/MV: Do you want to overwrite "ALLIN/LS2"?  y 
    1. Some special places.

When moving a directory, when the target directory does not exist, it is equivalent to changing the name

[Email protected] tmp]# ls2.txt Allin Allinlinux Systemd-private-a8472426664940399000bf05f5b4a2c8-vmtoolsd.service-ceavag Tmp[[email protected] tmp]# mv allin/  Allin2/[[email protected] tmp]# ls2.txt allin2 allinlinux SYSTEMD-PRIVATE-A8472426664940399000BF05F5B4A2C8-VMTOOLSD.SERVICE-CEAVAG tmp


This article is from the "Linux Road" blog, make sure to keep this source http://allin28.blog.51cto.com/12931477/1933852

Linux MV Command

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.