精品丰满熟女一区二区三区_五月天亚洲欧美综合网_亚洲青青青在线观看_国产一区二区精选

  • <menu id="29e66"></menu>

    <bdo id="29e66"><mark id="29e66"><legend id="29e66"></legend></mark></bdo>

  • <pre id="29e66"><tt id="29e66"><rt id="29e66"></rt></tt></pre>

      <label id="29e66"></label><address id="29e66"><mark id="29e66"><strike id="29e66"></strike></mark></address>
      學(xué)習(xí)啦>學(xué)習(xí)電腦>操作系統(tǒng)>Linux教程>

      linux中的mv命令的詳細(xì)解釋(2)

      時(shí)間: 佳洲1085 分享

        三、Linux中的mv命令使用實(shí)例——目錄操作

        實(shí)例1:目錄的移動(dòng)

        命令:

        mv dir1 dir2

        輸出:

        復(fù)制代碼

        代碼如下:

        [root@localhost test4]# ll

        -rw-r--r-- 1 root root 13 10-28 06:16 log2.txt

        [root@localhost test4]# ll

        -rw-r--r-- 1 root root 13 10-28 06:16 log2.txt

        [root@localhost test4]# cd ..

        [root@localhost test]# ll

        drwxr-xr-x 6 root root 4096 10-27 01:58 scf

        drwxrwxrwx 3 root root 4096 10-28 06:24 test3

        drwxr-xr-x 2 root root 4096 10-28 06:48 test4

        drwxr-xr-x 3 root root 4096 10-25 17:56 test5

        [root@localhost test]# cd test3

        [root@localhost test3]# ll

        drwxr-xr-x 2 root root 4096 10-28 06:21 logs

        -rw-r--r-- 1 root root 29 10-28 06:05 test1.txt

        [root@localhost test3]# cd ..

        [root@localhost test]# mv test4 test3

        [root@localhost test]# ll

        drwxr-xr-x 6 root root 4096 10-27 01:58 scf

        drwxrwxrwx 4 root root 4096 10-28 06:54 test3

        drwxr-xr-x 3 root root 4096 10-25 17:56 test5

        [root@localhost test]# cd test3/

        [root@localhost test3]# ll

        drwxr-xr-x 2 root root 4096 10-28 06:21 logs

        -rw-r--r-- 1 root root 29 10-28 06:05 test1.txt

        drwxr-xr-x 2 root root 4096 10-28 06:48 test4

        [root@localhost test3]#

        說(shuō)明:

        如果目錄dir2不存在,將目錄dir1改名為dir2;否則,將dir1移動(dòng)到dir2中。

        實(shí)例2:移動(dòng)當(dāng)前文件夾下的所有文件到上一級(jí)目錄

        命令:

        mv * ../

        輸出:

        復(fù)制代碼

        代碼如下:

        [root@localhost test4]# ll

        -rw-r--r-- 1 root root 25 10-28 07:02 log1.txt

        -rw-r--r-- 1 root root 13 10-28 06:16 log2.txt

        [root@localhost test4]# mv * ../

        [root@localhost test4]# ll

        [root@localhost test4]# cd ..

        [root@localhost test3]# ll

        -rw-r--r-- 1 root root 25 10-28 07:02 log1.txt

        -rw-r--r-- 1 root root 13 10-28 06:16 log2.txt

        drwxr-xr-x 2 root root 4096 10-28 06:21 logs

        -rw-r--r-- 1 root root 29 10-28 06:05 test1.txt

        drwxr-xr-x 2 root root 4096 10-28 07:02 test4

        實(shí)例3:把當(dāng)前目錄的一個(gè)子目錄里的文件移動(dòng)到另一個(gè)子目錄里

        命令:

        mv test3/*.txt test5

        輸出:

        復(fù)制代碼

        代碼如下:

        [root@localhost test]# ll

        drwxr-xr-x 6 root root 4096 10-27 01:58 scf

        drwxrwxrwx 4 root root 4096 10-28 07:02 test3

        drwxr-xr-x 3 root root 4096 10-25 17:56 test5

        [root@localhost test]# cd test3

        [root@localhost test3]# ll

        -rw-r--r-- 1 root root 25 10-28 07:02 log1.txt

        -rw-r--r-- 1 root root 13 10-28 06:16 log2.txt

        drwxr-xr-x 2 root root 4096 10-28 06:21 logs

        -rw-r--r-- 1 root root 29 10-28 06:05 test1.txt

        drwxr-xr-x 2 root root 4096 10-28 07:02 test4

        [root@localhost test3]# cd ..

        [root@localhost test]# mv test3/*.txt test5

        [root@localhost test]# cd test5

        [root@localhost test5]# ll

        -rw-r--r-- 1 root root 25 10-28 07:02 log1.txt

        -rw-r--r-- 1 root root 13 10-28 06:16 log2.txt

        -rw-r--r-- 1 root root 29 10-28 06:05 test1.txt

        drwxr-xr-x 2 root root 4096 10-25 17:56 test5-1

        [root@localhost test5]# cd ..

        [root@localhost test]# cd test3/

        [root@localhost test3]# ll

        drwxr-xr-x 2 root root 4096 10-28 06:21 logs

        drwxr-xr-x 2 root root 4096 10-28 07:02 test4

        [root@localhost test3]#

        實(shí)例4:文件被覆蓋前做簡(jiǎn)單備份,前面加參數(shù)-b

        命令:

        mv log1.txt -b log2.txt

        輸出:

        復(fù)制代碼

        代碼如下:

        [root@localhost test5]# ll

        -rw-r--r-- 1 root root 25 10-28 07:02 log1.txt

        -rw-r--r-- 1 root root 13 10-28 06:16 log2.txt

        -rw-r--r-- 1 root root 29 10-28 06:05 test1.txt

        drwxr-xr-x 2 root root 4096 10-25 17:56 test5-1

        [root@localhost test5]# mv log1.txt -b log2.txt

        mv:是否覆蓋“log2.txt”? y

        [root@localhost test5]# ll

        -rw-r--r-- 1 root root 25 10-28 07:02 log2.txt

        -rw-r--r-- 1 root root 13 10-28 06:16 log2.txt~

        -rw-r--r-- 1 root root 29 10-28 06:05 test1.txt

        drwxr-xr-x 2 root root 4096 10-25 17:56 test5-1

        [root@localhost test5]#

      3635566