linux常用指令(拷貝移動命令)
(1).cp--復制
cp hello.txt itcast/ -- 將hello.txt復制到itcast目錄中 cp hello.txt ./hi.txt -- 將hello.txt復制到當前目錄,并改名為hi.txt cp -r itcast/ ./itheima/ -- 將itcast目錄和目錄下所有文件復制到itheima目錄下 cp -r itcast/* ./itheima/ -- 將itcast目錄下所有文件復制到itheima目錄下
-- -r:表示對目錄遞歸復制
(2).mv--移動
mv hello.txt hi.txt -- 將hello.txt改名為hi.txt(移動hello.txt到當前位置,并重命名=重命名) mv hi.txt itheima/ -- 將文件hi.txt移動到itheima目錄中 mv hi.txt itheima/hello.txt -- 將hi.txt移動到itheima目錄中,并改名為hello.txt mv itcast/ itheima/ -- 如果itheima目錄不存在,將itcast目錄改名為itheima mv itcast/ itheima/ -- 如果itheima目錄存在,將itcast目錄移動到itheima目錄中

浙公網安備 33010602011771號