Unix移动复制mv cp
2011-07-25 20:28
323 查看
mv
This command will move a file. You can usemvnot only to change the directory location of a file, but also to rename files. Unlike the
cpcommand,
mvwill not preserve the original file.
Note: As with the
cpcommand, you should always use
-ito make sure you do not overwrite an existing file.
To rename a file named
oldnamein the current directory to the new name
newname, enter:
mv-ioldname newname To move a file named
hw1from a subdirectory named
newhwto another subdirectory named
oldhw(both subdirectories of the current directory), enter:
mv-inewhw/hw1 oldhwIf, in this last operation, you also wanted to give the file a new name, such as
firsthw, you would enter:
mv-inewhw/hw1 oldhw/firsthw
cp
This command copies a file, preserving the original and creating an identical copy. If you already have a file with the new name,cpwill overwrite and destroy the duplicate. For this reason, it's safest to always add
-iafter the
cpcommand, to force the system to ask for your approval before it destroys any files. The general syntax for
cpis:
cp-ioldfile newfile To copy a file named
meeting1in the directory
/home/dvader/notesto your current directory, enter:
cp-i/home/dvader/notes/meeting1.The
.(period) indicates the current directory as destination, and the
-iensures that if there is another file named
meeting1in the current directory, you will not overwrite it by accident.
To copy a file named
oldfilein the current directory to the new name
newfilein the
mystuffsubdirectory of your home directory, enter:
cp-ioldfile ~/mystuff/newfile The
~character (tilde) is interpreted as the path of your home directory.
Note: You must have permission to read a file in order to copy it.
相关文章推荐
- [转]复制、移动和删除:cp, rm, mv
- cp 复制 ,mv 移动
- linux 命令之 复制移动重命名(cp ,mv ,install)
- 复制、移动和删除:cp, rm, mv
- linux下文件的复制、移动与删除命令为:cp,mv,rm
- Linux命令学习(一):复制(cp),删除(rm)和移动(mv)文件的命令
- linux下文件的复制、移动与删除命令为:cp,mv,rm
- linux命令---复制和移动文件 cp和mv
- 复制、删除与移动: cp, rm, mv
- linux-14基础命令之-复制(cp)移动(mv),删除(rm),拷贝文件(dd)
- 文件的复制和移动命令:cp和mv
- linux学习(6) ls(查看文件,目录) 复制、删除与移动: cp, rm, mv,取得路径的文件名称与目录名称
- 复制、移动和删除:cp, rm, mv
- Linux基础命令之-复制、删除与移动:cp,rm,mv
- linux中cp复制、mv移动、重命名,SVN回滚命令的应用
- linux下文件的复制、移动与删除命令为:cp,mv,rm
- 复制、移动和删除:cp, rm, mv
- Linux命令之目录切换、创建/删除/复制/移动文件 - cd,mkdir,cp,mv,rmdir,rm
- linux下文件的复制、移动与删除命令为:cp,mv,rm
- 文件的复制,移动和删除命令(cp,mv,rm)