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目录中

 

posted @ 2023-05-29 16:41  Davis·Hisa  阅读(2041)  评论(0编辑  收藏  举报