centos 和ubuntu中 rename命令使用的区别

1、系统及测试文件

(1)ubuntu系统

复制代码
root@PC1:/home/test2# ls
outcome.map  outcome.ped
root@PC1:/home/test2# hostnamectl
   Static hostname: PC1
         Icon name: computer-vm
           Chassis: vm
        Machine ID: dc50d4dc469c45ea8a2a10f39caa45e9
           Boot ID: 0eb1ebdfab9e4c969a29643e910a352c
    Virtualization: vmware
  Operating System: Ubuntu 20.04.3 LTS         ## ubuntu系统
            Kernel: Linux 5.13.0-37-generic
      Architecture: x86-64
复制代码

 

(2)centos系统

复制代码
[root@virtualboxcentos7 test]# ls
outcome.map  outcome.ped
[root@virtualboxcentos7 test]# hostnamectl
   Static hostname: virtualboxcentos7
         Icon name: computer-vm
           Chassis: vm
        Machine ID: e8d08b54fc55254aaefd55597b2e435b
           Boot ID: f7ec5c87c15e4db396b9bb60b2388b7d
    Virtualization: kvm
  Operating System: CentOS Linux 7 (Core)    ## centos系统
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-1160.49.1.el7.x86_64
      Architecture: x86-64
复制代码

 

 

2、centos中rename用法

复制代码
[root@virtualboxcentos7 test]# ls
outcome.map  outcome.ped
[root@virtualboxcentos7 test]# hostnamectl
   Static hostname: virtualboxcentos7
         Icon name: computer-vm
           Chassis: vm
        Machine ID: e8d08b54fc55254aaefd55597b2e435b
           Boot ID: f7ec5c87c15e4db396b9bb60b2388b7d
    Virtualization: kvm
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-1160.49.1.el7.x86_64
      Architecture: x86-64
[root@virtualboxcentos7 test]# rename outcome xxx outcome.*
[root@virtualboxcentos7 test]# ls
xxx.map  xxx.ped
复制代码

 

 

3、ubuntu中rename用法

复制代码
root@PC1:/home/test2# ls
outcome.map  outcome.ped
root@PC1:/home/test2# hostnamectl
   Static hostname: PC1
         Icon name: computer-vm
           Chassis: vm
        Machine ID: dc50d4dc469c45ea8a2a10f39caa45e9
           Boot ID: 0eb1ebdfab9e4c969a29643e910a352c
    Virtualization: vmware
  Operating System: Ubuntu 20.04.3 LTS
            Kernel: Linux 5.13.0-37-generic
      Architecture: x86-64
root@PC1:/home/test2# rename outcome xxx outcome.*    ## 不能直接使用
Bareword "outcome" not allowed while "strict subs" in use at (user-supplied code).
root@PC1:/home/test2# ls
outcome.map  outcome.ped
root@PC1:/home/test2# rename 's/outcome/xxx/' outcome.*    ## 正确使用形式
root@PC1:/home/test2# ls
xxx.map  xxx.ped
复制代码

 

posted @   小鲨鱼2018  阅读(407)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
点击右上角即可分享
微信分享提示