linux命令之rename

简介:
不同于Dos下的rename命令,linux下的rename命令功能非常强大。

 

#man rename

 

NAME
       rename - Rename files

SYNOPSIS
       rename from to file...

DESCRIPTION
       rename will rename the specified files by replacing the first occurrence of from in their name by to.

       For example, given the files foo1, ..., foo9, foo10, ..., foo278, the commands

              rename foo foo0 foo?
              rename foo foo0 foo??

       will turn them into foo001, ..., foo009, foo010, ..., foo278.

       And
              rename .htm .html *.htm

       will fix the extension of your html files.

 

从上面可以看到:

1. rename命令是三个参数

2. rename命令支持通配符进行批量重命名

3. rename命令会不会支持正则表达式

 

rename的参数

 


rename命令的格式:
rename [ -v ] [ -n ] [ -f ] perlexpr [ files ]

 

第一个参数:被替换掉的字符串
第二个参数:替换成的字符串
第三个参数:匹配要替换的文件模式
目录
相关文章
|
7天前
|
Web App开发 Linux 网络安全
工作中常用到的Linux命令
工作中常用到的Linux命令
|
8天前
|
Web App开发 Java Linux
Linux之Shell基本命令篇
Linux之Shell基本命令篇
Linux之Shell基本命令篇
|
15天前
|
Ubuntu 架构师 Java
Linux系统常用命令非常详细建议收藏
Linux系统常用命令非常详细建议收藏
48 0
|
5天前
|
NoSQL Linux Shell
常用的 Linux 命令
常用的 Linux 命令
27 9
|
23小时前
|
网络协议 Ubuntu Linux
Linux 下 TFTP 服务搭建及 U-Boot 中使用 tftp 命令实现文件下载
Linux 下 TFTP 服务搭建及 U-Boot 中使用 tftp 命令实现文件下载
|
1天前
|
Linux Go
Linux命令Top 100驱动人生! 面试必备
探索Linux命令不再迷茫!本文分10部分详解20个基础命令,带你由浅入深掌握文件、目录管理和文本处理。 [1]: <https://cloud.tencent.com/developer/article/2396114> [2]: <https://pan.quark.cn/s/865a0bbd5720> [3]: <https://yv4kfv1n3j.feishu.cn/docx/MRyxdaqz8ow5RjxyL1ucrvOYnnH>
8 0
|
3天前
|
缓存 运维 监控
Linux系统监控利器:探索常用命令及数据保存技巧
Linux系统监控利器:探索常用命令及数据保存技巧
23 4
Linux系统监控利器:探索常用命令及数据保存技巧
|
6天前
|
Linux 索引
linux 文件查找 和文件管理常用命令
linux 文件查找 和文件管理常用命令
17 0
|
7天前
|
安全 Unix Linux
一、linux 常用命令之 linux版本信息 系统管理与设置 持续更新******
一、linux 常用命令之 linux版本信息 系统管理与设置 持续更新******
13 0
|
8天前
|
Prometheus 监控 Cloud Native
【Linux】查看系统内存命令(详细讲解)
【Linux】查看系统内存命令(详细讲解)