linux mv编写代码,linux命令——mv(示例代码)

mv命令是move的缩写形式,通过这个命令可以移动文件以及重命名文件!在渗透测试中常用于重命名文件,在命令执行漏洞中,我们需要上传webshell或者nc这类的工具,如果直接wget的话,很有可能被防或者被杀,因此我们需要先wget一个文本文件或者图像文件到远程服务器上,然后再通过mv来重命名来还原文件!

基本使用语法(移动):mv 源文件 目标目录[email protected]:~/eth10/eth10# ls

test1  test.txt

[email protected]:~/eth10/eth10# ls test1

[email protected]:~/eth10/eth10# mv test.txt test1/

[email protected]:~/eth10/eth10# ls

test1

[email protected]:~/eth10/eth10# ls test1/

test.txt

基本使用语法(重命名):mv 源文件 重命名后的文件[email protected]:~/eth10/eth10# ls

test1  test1.txt

[email protected]:~/eth10/eth10# mv test1.txt test.txt

[email protected]:~/eth10/eth10# ls

test1  test.txt

另外如果有同名文件的,需要添加-i参数来提醒是否需要覆盖,不然默认就把同名文件替换了,回复y是替换,回复n是跳过该文件![email protected]:~/eth10/eth10# ls

test1.txt  test.txt

[email protected]:~/eth10/eth10# mv -i test1.txt test.txt

mv:是否覆盖‘test.txt‘? n

其次我们可以使用-b来对存在同名文件的文件进行添加~进行重命名[email protected]:~/eth10/eth10# ls

test1.txt  test.txt

[email protected]:~/eth10/eth10# mv -b test1.txt test.txt

[email protected]:~/eth10/eth10# ls

test.txt  test.txt~

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值