linux下的mv命令怎么用? (linux 下mv)

移动 和重命名命令

linux下士这么解释的

mv –help

Usage: mv … SOURCE DEST

or: mv … SOURCE… DIRECTORY

or: mv … -t DIRECTORY SOURCE…

Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.

Mandatory arguments to long options are mandatory for short options too.

backupmake a backup of each existing destination file

-blike –backup but does not accept an argument

-f, –force do not prompt before overwriting

-i, –interactiveprompt before overwrite

strip-trailing-slashes remove any trailing slashes from each SOURCE

argument

-S, –suffix=SUFFIXoverride the usual backup suffix

-t, –target-directory=DIRECTORY move all SOURCE arguments into DIRECTORY

-T, –no-target-directory treat DEST as a normal file

-u, –update move only when the SOURCE file is newer

than the destination file or when the

destination file is missing

-v, –verbose explain what is being done

help display this help and exit

version output version information and exit

The backup suffix is `~’, unless set with –suffix or SIMPLE_BACKUP_SUFFIX.

The version control method may be selected via the –backup option or through

the VERSION_CONTROL environment variable. Here are the values:

none, offnever make backups (even if –backup is given)

numbered, t make numbered backups

existing, nil numbered if numbered backups exist, simple otherwise

simple, never always make simple backups

mv a.txt b.txt 将a.txt 改名为b.txt

mv a.txt /mnt/b.txt 同时更改路径为/mnt/

mv a.txt /opt/ftp/圆乱 将a.txt 剪切到/opt/橘茄档ftp/下

常纳差用的用法就是以上。

mv 是移动命令,在移到过程中可以改名字,既有腔猜态剪切的效果,还可以做到重命名。

更详细的参数兆亏,伍源可以在linux系统里面用 man mv 来查看。

Linux mv命令

mv命令是move的缩写,可明神以用来移动前手文件或者将文件改名,是Linux系统下常用的命令,经常用来备份文件或者目录。

1、命令格式

mv 源文件或目录 目标文件或目录

选项:

-f 强制覆盖,如果目标文件已经存在,则不询问,直接强制覆盖;

-i 交互移动,如果目标文件已经存在,则询问用户是否覆盖;

-n 如果目标文件已经存在,则不激悔亏会覆盖,而且不询问用户;

-v 显示文件或目录的移动过程;

-u 若目标文件已经存在,但两者相比,源文件更新,则会对目标文件进行升级。

2、命令功能

相关问题拓展阅读:

linux中,用mv命令移动多个目录

完全厅羡正确州游- –

最后一个目录为扮迹拍目标目录

mv /a /b /c /d

mv a b c d

mv /{a,b,c} /d

这些哪个都可以

分为两种情况:

之一种:目标目录为空,使用mv命令可以直接移动,使用绝对路径执行或加参数-f 不会提示友差是否移动。

# mkdir 1

# mkdir /tmp/1

# mv 1/ /信嫌tmp/

mv: overwrite `/tmp/1′? n

第二种:目标目录非空,使用绝对路径执行也会提示目录非空不能移动,需要滑告手加一个参数-b 加参数后可以移动,同时会备份目标目录一份。备份目录后面 ~ 表示;

# mkdir 2

# mkdir /tmp/2

# touch /tmp/2/2.txt

# /bin/mv 2/ /tmp/

/bin/mv: cannot move `2/’ to `/tmp/2′: Directory not empty

# ls /tmp/

1 2 yum.log

# ls /tmp/

~ yum.log

0 分..刚才那个 :wq 存档 15 分.., 呵呵,帮人不计较了

在命令模碰闹岩式下

:!mv /{a,b,c} /d

如果在当前目录, 那 / 不用了, 我的 login shell 是 bash ,

成功后会提示笑御,press enter to continue, 返回命令模式,

这样可以吗?呵弯判呵

搅错了,原来不是VIM, 这样就成

mv /{a,b,c} /d

for Directory in a b c;do

mv /$Directory /d

done

额,不可以吧。档乱雀试想下,行早机器怎么判断源文件和目标文件,前几个是原文件?分别移动到不同文件?

linux mv命令帮解析

这里用的是mv重命名功能,吧cdsinit这个文件重命名为.cdsinit

mv /eda/tools/dfII/local/cdsinit /eda/tools/dfII/local/.cdsinit

把/eda/tools/dfll/local/目录下的cdsinit文件移动到/eda/tools/dfII/local/目录下,不过这两个目录好像是相同的,只是把文件名前面加了个. 变成了隐藏文件

你悄察脊说的当前目录是cd /eda,这没桐个是进入/eda的命令,启渗cd是进入这个文件夹。

mv是英语move的缩写,是linux里移动文件或者文件夹的命令。

/eda/tools/dfII/local/下面的cdsinit改名为.cdsinit

linux 下mv的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于linux 下mv,linux下的mv命令怎么用?,linux中,用mv命令移动多个目录,linux mv命令帮解析的信息别忘了在本站进行查找喔。


数据运维技术 » linux下的mv命令怎么用? (linux 下mv)