本文档风哥主要介绍Linux系统中mv命令的使用方法,包括文件重命名、文件移动、目录移动等操作,结合RHEL LINUX 10系统环境,提供详细的命令示例和输出结果,适合Linux运维人员在学习和生产环境中使用。更多视频教程www.fgedu.net.cn
参考Red Hat Enterprise Linux 10官方文档中的System administration章节
Part01-基础概念与理论知识
1.1 mv命令的基本概念
mv命令是Linux系统中用于移动文件或目录的命令,也可以用于重命名文件或目录。mv命令可以将文件从一个位置移动到另一个位置,或者在同一个目录下重命名文件。mv命令是move的缩写,是Linux系统中最常用的文件管理命令之一。
- 可以移动文件和目录
- 可以重命名文件和目录
- 移动速度快(同一文件系统内只修改指针)
- 默认会覆盖目标文件
- 可以保留文件属性
1.2 mv命令的语法格式
mv命令的基本语法格式如下: 学习交流加群风哥QQ113257174
mv [选项] 源文件 目标文件
mv [选项] 源文件… 目录
# 语法说明:
# 源文件:要移动或重命名的文件或目录
# 目标文件:目标文件名或目录名
# 如果目标是目录,则源文件会被移动到该目录下
# 如果目标是文件,则源文件会被重命名为目标文件名
1.3 mv命令的常用参数
mv命令的常用参数如下:
# -i, –interactive
# 交互模式,覆盖前询问
mv -i source.txt dest.txt
# -f, –force
# 强制覆盖,不询问
mv -f source.txt dest.txt
# -n, –no-clobber
# 不覆盖已存在的文件
mv -n source.txt dest.txt
# -v, –verbose
# 显示详细信息
mv -v source.txt dest.txt
# -u, –update
# 只在源文件比目标文件新时才移动
mv -u source.txt dest.txt
# -b, –backup
# 覆盖前备份目标文件
mv -b source.txt dest.txt
# –backup=CONTROL
# 指定备份方式:none, off, numbered, t, existing, nil, simple, never
mv –backup=numbered source.txt dest.txt
# -S, –suffix=SUFFIX
# 指定备份后缀
mv -b -S .bak source.txt dest.txt
# –preserve
# 保留文件属性(权限、时间戳等)
mv –preserve source.txt dest.txt
# –strip-trailing-slashes
# 删除源文件参数末尾的斜杠
mv –strip-trailing-slashes source/ dest/
Part02-生产环境规划与建议
2.1 mv命令使用场景规划
在生产环境中,mv命令主要用于以下场景:
# 1. 文件重命名场景
# – 配置文件版本切换
# – 日志文件归档
# – 备份文件管理
# 2. 文件移动场景
# – 数据迁移
# – 临时文件整理
# – 目录结构调整
# 3. 目录重命名场景
# – 项目目录重命名
# – 版本目录切换
# – 备份目录管理
# 4. 批量操作场景
# – 批量文件移动
# – 批量文件重命名
# – 批量目录整理
2.2 mv命令安全使用建议
在生产环境中使用mv命令时,需要注意以下安全建议: 更多学习教程公众号风哥教程itpux_com
- 使用-i参数避免误覆盖重要文件
- 重要文件移动前先备份
- 使用-v参数确认操作过程
- 跨文件系统移动大文件时注意磁盘空间
- 避免在脚本中使用通配符移动文件
- 移动目录时确认目标路径存在
2.3 mv命令最佳实践
mv命令在生产环境中的最佳实践:
# 1. 重命名前检查目标文件是否存在
# ls dest.txt && echo “文件已存在” || mv source.txt dest.txt
# 2. 使用备份参数保护重要文件
# mv -b –backup=numbered important.conf important.conf.bak
# 3. 批量移动时使用find命令
# find /tmp -name “*.log” -exec mv {} /var/log/archive/ \;
# 4. 移动前确认磁盘空间
# df -h /target/directory
# mv large_file.tar /target/directory/
# 5. 使用日志记录移动操作
# mv -v source.txt dest.txt | tee -a /var/log/mv_operations.log
Part03-生产环境项目实施方案
3.1 文件重命名操作
文件重命名是mv命令最常见的用法之一,以下是在RHEL LINUX 10系统中的实际操作示例:
# 1. 基本重命名操作
# ls -l
total 4
-rw-r–r–. 1 root root 100 Apr 2 10:00 oldname.txt
# mv oldname.txt newname.txt
# ls -l
total 4
-rw-r–r–. 1 root root 100 Apr 2 10:00 newname.txt
# 2. 交互式重命名(覆盖前询问)
# touch newname.txt
# mv -i oldname.txt newname.txt
mv: overwrite ‘newname.txt’? y
# 3. 不覆盖已存在的文件
# mv -n oldname.txt newname.txt
# echo $?
1
# ls -l newname.txt
-rw-r–r–. 1 root root 0 Apr 2 10:05 newname.txt
# 4. 备份后重命名
# mv -b oldname.txt newname.txt
# ls -l
total 8
-rw-r–r–. 1 root root 100 Apr 2 10:00 newname.txt
-rw-r–r–. 1 root root 0 Apr 2 10:05 newname.txt~
# 5. 指定备份后缀
# mv -b -S .bak oldname.txt newname.txt
# ls -l
total 8
-rw-r–r–. 1 root root 100 Apr 2 10:00 newname.txt
-rw-r–r–. 1 root root 0 Apr 2 10:05 newname.txt.bak
# 6. 显示详细信息
# mv -v oldname.txt newname.txt
renamed ‘oldname.txt’ -> ‘newname.txt’
# 7. 只在源文件较新时重命名
# touch -t 202601011200 oldname.txt
# touch -t 202602011200 newname.txt
# mv -u oldname.txt newname.txt
# ls -l
total 8
-rw-r–r–. 1 root root 0 Jan 1 12:00 oldname.txt
-rw-r–r–. 1 root root 0 Feb 1 12:00 newname.txt
# 8. 保留文件属性重命名
# touch -t 202603011200 preserve.txt
# chmod 755 preserve.txt
# ls -l preserve.txt
-rwxr-xr-x. 1 root root 0 Mar 1 12:00 preserve.txt
# mv –preserve preserve.txt preserved_file.txt
# ls -l preserved_file.txt
-rwxr-xr-x. 1 root root 0 Mar 1 12:00 preserved_file.txt
3.2 文件移动操作
文件移动是mv命令的核心功能,以下是在RHEL LINUX 10系统中的实际操作示例:
# 1. 移动单个文件到目录
# mkdir -p /tmp/target
# touch /tmp/source.txt
# mv /tmp/source.txt /tmp/target/
# ls -l /tmp/target/
total 0
-rw-r–r–. 1 root root 0 Apr 2 10:00 source.txt
# 2. 移动多个文件到目录
# touch file1.txt file2.txt file3.txt
# mv file1.txt file2.txt file3.txt /tmp/target/
# ls -l /tmp/target/
total 0
-rw-r–r–. 1 root root 0 Apr 2 10:00 file1.txt
-rw-r–r–. 1 root root 0 Apr 2 10:00 file2.txt
-rw-r–r–. 1 root root 0 Apr 2 10:00 file3.txt
-rw-r–r–. 1 root root 0 Apr 2 10:00 source.txt
# 3. 移动文件并重命名
# mv /tmp/target/source.txt /tmp/target/renamed.txt
# ls -l /tmp/target/
total 0
-rw-r–r–. 1 root root 0 Apr 2 10:00 file1.txt
-rw-r–r–. 1 root root 0 Apr 2 10:00 file2.txt
-rw-r–r–. 1 root root 0 Apr 2 10:00 file3.txt
-rw-r–r–. 1 root root 0 Apr 2 10:00 renamed.txt
# 4. 使用通配符移动文件
# touch log1.txt log2.txt log3.txt
# mv log*.txt /tmp/target/
# ls -l /tmp/target/
total 0
-rw-r–r–. 1 root root 0 Apr 2 10:00 file1.txt
-rw-r–r–. 1 root root 0 Apr 2 10:00 file2.txt
-rw-r–r–. 1 root root 0 Apr 2 10:00 file3.txt
-rw-r–r–. 1 root root 0 Apr 2 10:00 log1.txt
-rw-r–r–. 1 root root 0 Apr 2 10:00 log2.txt
-rw-r–r–. 1 root root 0 Apr 2 10:00 log3.txt
-rw-r–r–. 1 root root 0 Apr 2 10:00 renamed.txt
# 5. 移动隐藏文件
# touch .hidden_file
# mv .hidden_file /tmp/target/
# ls -la /tmp/target/ | grep hidden
-rw-r–r–. 1 root root 0 Apr 2 10:00 .hidden_file
# 6. 移动文件到不存在的目录(会报错)
# mv file.txt /nonexistent/
mv: cannot move ‘file.txt’ to ‘/nonexistent/’: No such file or directory
# 7. 强制移动文件
# touch /tmp/target/force.txt
# touch force.txt
# mv -f force.txt /tmp/target/
# echo $?
0
# 8. 移动文件并显示进度
# dd if=/dev/zero of=largefile bs=1M count=100
100+0 records in
100+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 0.123456 s, 849 MB/s
# mv -v largefile /tmp/target/
renamed ‘largefile’ -> ‘/tmp/target/largefile’
3.3 目录移动与重命名
目录移动和重命名操作在RHEL LINUX 10系统中的实际示例:
# 1. 重命名目录
# mkdir old_dir
# mv old_dir new_dir
# ls -ld new_dir
drwxr-xr-x. 2 root root 6 Apr 2 10:00 new_dir
# 2. 移动目录到另一个目录下
# mkdir -p /tmp/dest
# mkdir source_dir
# mv source_dir /tmp/dest/
# ls -ld /tmp/dest/source_dir
drwxr-xr-x. 2 root root 6 Apr 2 10:00 /tmp/dest/source_dir
# 3. 移动目录及其内容
# mkdir -p dir_with_content/{subdir1,subdir2}
# touch dir_with_content/file1.txt
# touch dir_with_content/subdir1/file2.txt
# mv dir_with_content /tmp/dest/
# ls -lR /tmp/dest/dir_with_content/
/tmp/dest/dir_with_content/:
total 0
drwxr-xr-x. 2 root root 6 Apr 2 10:00 subdir1
drwxr-xr-x. 2 root root 6 Apr 2 10:00 subdir2
-rw-r–r–. 1 root root 0 Apr 2 10:00 file1.txt
/tmp/dest/dir_with_content/subdir1:
total 0
-rw-r–r–. 1 root root 0 Apr 2 10:00 file2.txt
/tmp/dest/dir_with_content/subdir2:
total 0
# 4. 合并目录(目标目录已存在)
# mkdir -p source_merge/{dir1,dir2}
# touch source_merge/file_a.txt
# mkdir -p /tmp/dest/target_merge/{dir3,dir4}
# touch /tmp/dest/target_merge/file_b.txt
# mv source_merge/* /tmp/dest/target_merge/
# ls -l /tmp/dest/target_merge/
total 0
drwxr-xr-x. 2 root root 6 Apr 2 10:00 dir1
drwxr-xr-x. 2 root root 6 Apr 2 10:00 dir2
drwxr-xr-x. 2 root root 6 Apr 2 10:00 dir3
drwxr-xr-x. 2 root root 6 Apr 2 10:00 dir4
-rw-r–r–. 1 root root 0 Apr 2 10:00 file_a.txt
-rw-r–r–. 1 root root 0 Apr 2 10:00 file_b.txt
# 5. 移动目录时覆盖同名文件
# mkdir -p conflict_dir
# touch conflict_dir/test.txt
# mkdir -p /tmp/dest/conflict_dir
# touch /tmp/dest/conflict_dir/test.txt
# echo “old content” > /tmp/dest/conflict_dir/test.txt
# mv -i conflict_dir /tmp/dest/
mv: overwrite ‘/tmp/dest/conflict_dir/test.txt’? y
# cat /tmp/dest/conflict_dir/test.txt
Part04-生产案例与实战讲解
4.1 批量文件移动案例
在生产环境中,经常需要批量移动文件,以下是实际案例:
# 1. 按日期批量移动日志文件
# mkdir -p /var/log/archive/2026-04-02
# ls /var/log/*.log
/var/log/boot.log /var/log/dnf.log /var/log/hawkey.log
# mv -v /var/log/*.log /var/log/archive/2026-04-02/
renamed ‘/var/log/boot.log’ -> ‘/var/log/archive/2026-04-02/boot.log’
renamed ‘/var/log/dnf.log’ -> ‘/var/log/archive/2026-04-02/dnf.log’
renamed ‘/var/log/hawkey.log’ -> ‘/var/log/archive/2026-04-02/hawkey.log’
# 2. 使用find命令批量移动
# mkdir -p /tmp/old_files
# touch /tmp/old_files/file{1..10}.txt
# find /tmp/old_files -name “*.txt” -exec mv -v {} /tmp/target/ \;
renamed ‘/tmp/old_files/file1.txt’ -> ‘/tmp/target/file1.txt’
renamed ‘/tmp/old_files/file2.txt’ -> ‘/tmp/target/file2.txt’
renamed ‘/tmp/old_files/file3.txt’ -> ‘/tmp/target/file3.txt’
renamed ‘/tmp/old_files/file4.txt’ -> ‘/tmp/target/file4.txt’
renamed ‘/tmp/old_files/file5.txt’ -> ‘/tmp/target/file5.txt’
renamed ‘/tmp/old_files/file6.txt’ -> ‘/tmp/target/file6.txt’
renamed ‘/tmp/old_files/file7.txt’ -> ‘/tmp/target/file7.txt’
renamed ‘/tmp/old_files/file8.txt’ -> ‘/tmp/target/file8.txt’
renamed ‘/tmp/old_files/file9.txt’ -> ‘/tmp/target/file9.txt’
renamed ‘/tmp/old_files/file10.txt’ -> ‘/tmp/target/file10.txt’
# 3. 按文件大小移动
# mkdir -p /tmp/large_files
# find /tmp -type f -size +10M -exec mv -v {} /tmp/large_files/ \;
# 4. 按修改时间移动
# mkdir -p /tmp/old_logs
# find /var/log -type f -mtime +30 -exec mv -v {} /tmp/old_logs/ \;
# 5. 批量移动并重命名
# mkdir -p /tmp/photos
# touch /tmp/IMG_{001..005}.jpg
# cd /tmp
# for file in IMG_*.jpg; do
mv -v “$file” “vacation_${file}”
done
renamed ‘IMG_001.jpg’ -> ‘vacation_IMG_001.jpg’
renamed ‘IMG_002.jpg’ -> ‘vacation_IMG_002.jpg’
renamed ‘IMG_003.jpg’ -> ‘vacation_IMG_003.jpg’
renamed ‘IMG_004.jpg’ -> ‘vacation_IMG_004.jpg’
renamed ‘IMG_005.jpg’ -> ‘vacation_IMG_005.jpg’
# 6. 批量移动不同类型文件到不同目录
# mkdir -p /tmp/sorted/{images,documents,scripts}
# touch /tmp/file.{jpg,png,pdf,doc,sh,py}
# mv /tmp/*.jpg /tmp/*.png /tmp/sorted/images/
# mv /tmp/*.pdf /tmp/*.doc /tmp/sorted/documents/
# mv /tmp/*.sh /tmp/*.py /tmp/sorted/scripts/
# 7. 使用xargs批量移动
# find /tmp -name “*.tmp” -print0 | xargs -0 mv -t /tmp/temp_files/
# 8. 批量移动并记录日志
# mkdir -p /tmp/moved_files
# for file in /var/log/*.log; do
mv -v “$file” /tmp/moved_files/ 2>&1 | tee -a /var/log/move_operations.log
done
4.2 mv命令高级用法
mv命令的高级用法和技巧: from LinuxDBA视频:www.itpux.com
# 1. 使用mv命令创建备份版本
# touch config.conf
# mv –backup=numbered config.conf config.conf
# ls -l config.conf*
-rw-r–r–. 1 root root 0 Apr 2 10:00 config.conf
-rw-r–r–. 1 root root 0 Apr 2 10:00 config.conf.~1~
# 再次执行
# mv –backup=numbered config.conf config.conf
# ls -l config.conf*
-rw-r–r–. 1 root root 0 Apr 2 10:00 config.conf
-rw-r–r–. 1 root root 0 Apr 2 10:00 config.conf.~1~
-rw-r–r–. 1 root root 0 Apr 2 10:00 config.conf.~2~
# 2. 使用mv命令交换文件名
# touch file_a file_b
# echo “A” > file_a
# echo “B” > file_b
# mv file_a temp && mv file_b file_a && mv temp file_b
# cat file_a
B
# cat file_b
A
# 3. 使用mv命令移动文件到上级目录
# mkdir -p /tmp/test/subdir
# touch /tmp/test/subdir/file.txt
# cd /tmp/test/subdir
# mv file.txt ../
# ls -l ../file.txt
-rw-r–r–. 1 root root 0 Apr 2 10:00 ../file.txt
# 4. 使用mv命令移动文件到当前目录
# mv /path/to/file.txt .
# ls -l file.txt
-rw-r–r–. 1 root root 0 Apr 2 10:00 file.txt
# 5. 使用mv命令移动所有文件(包括隐藏文件)
# mkdir -p /tmp/source_all
# touch /tmp/source_all/{file1,file2,.hidden}
# mkdir -p /tmp/dest_all
# mv /tmp/source_all/{*,.*} /tmp/dest_all/ 2>/dev/null
# ls -la /tmp/dest_all/
total 8
drwxr-xr-x. 2 root root 6 Apr 2 10:00 .
drwxr-xr-x. 3 root root 6 Apr 2 10:00 ..
-rw-r–r–. 1 root root 0 Apr 2 10:00 .hidden
-rw-r–r–. 1 root root 0 Apr 2 10:00 file1
-rw-r–r–. 1 root root 0 Apr 2 10:00 file2
# 6. 使用mv命令移动文件并修改权限
# touch secure_file
# chmod 600 secure_file
# mv secure_file /tmp/
# ls -l /tmp/secure_file
-rw——-. 1 root root 0 Apr 2 10:00 /tmp/secure_file
# 7. 使用mv命令移动符号链接
# touch original.txt
# ln -s original.txt link_to_file
# mv link_to_file /tmp/
# ls -l /tmp/link_to_file
lrwxrwxrwx. 1 root root 6 Apr 2 10:00 /tmp/link_to_file -> original.txt
# 8. 使用mv命令移动硬链接
# touch hardlink_source.txt
# ln hardlink_source.txt hardlink_dest.txt
# ls -li hardlink*.txt
1234567 -rw-r–r–. 2 root root 0 Apr 2 10:00 hardlink_dest.txt
1234567 -rw-r–r–. 2 root root 0 Apr 2 10:00 hardlink_source.txt
# mv hardlink_dest.txt /tmp/
# ls -li /tmp/hardlink_dest.txt hardlink_source.txt
1234567 -rw-r–r–. 2 root root 0 Apr 2 10:00 /tmp/hardlink_dest.txt
1234567 -rw-r–r–. 2 root root 0 Apr 2 10:00 hardlink_source.txt
4.3 mv命令常见问题处理
mv命令在使用过程中可能遇到的问题及解决方案:
# 1. 权限不足问题
# mv /root/file.txt /tmp/
mv: cannot move ‘/root/file.txt’ to ‘/tmp/file.txt’: Permission denied
# 解决方案:使用sudo
# sudo mv /root/file.txt /tmp/
# 2. 目标目录不存在
# mv file.txt /nonexistent/path/
mv: cannot move ‘file.txt’ to ‘/nonexistent/path/’: No such file or directory
# 解决方案:先创建目录
# mkdir -p /nonexistent/path
# mv file.txt /nonexistent/path/
# 3. 跨文件系统移动大文件磁盘空间不足
# df -h /target
Filesystem Size Used Avail Use% Mounted on
/dev/sdb1 10G 9.5G 0.5G 95% /target
# mv large_file.tar /target/
mv: cannot move ‘large_file.tar’ to ‘/target/large_file.tar’: No space left on device
# 解决方案:检查磁盘空间,清理空间或使用其他存储
# 4. 文件被占用无法移动
# mv /var/log/messages /tmp/
mv: cannot move ‘/var/log/messages’ to ‘/tmp/messages’: Device or resource busy
# 解决方案:停止相关服务或使用lsof查看占用进程
# lsof /var/log/messages
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
rsyslogd 1234 root 1w REG 253,0 123456 123 /var/log/messages
# 5. 文件名包含特殊字符
# touch “file with spaces.txt”
# mv file with spaces.txt /tmp/
mv: cannot stat ‘file’: No such file or directory
mv: cannot stat ‘with’: No such file or directory
mv: cannot stat ‘spaces.txt’: No such file or directory
# 解决方案:使用引号或转义
# mv “file with spaces.txt” /tmp/
# 或
# mv file\ with\ spaces.txt /tmp/
# 6. 移动目录时目标已存在
# mkdir -p source_dir /tmp/dest/source_dir
# mv source_dir /tmp/dest/
mv: cannot move ‘source_dir’ to ‘/tmp/dest/source_dir’: Directory not empty
# 解决方案:使用合并方式或先删除目标目录
# mv source_dir/* /tmp/dest/source_dir/
# 7. 符号链接目标不存在
# ln -s /nonexistent/target link_file
# mv link_file /tmp/
# ls -l /tmp/link_file
lrwxrwxrwx. 1 root root 6 Apr 2 10:00 /tmp/link_file -> /nonexistent/target
# 解决方案:移动前检查符号链接有效性
# readlink -f link_file
/nonexistent/target
# 如果返回空,说明链接目标不存在
# 8. 移动只读文件系统上的文件
# mount -o remount,ro /tmp
# mv /tmp/file.txt /tmp/newfile.txt
mv: cannot move ‘/tmp/file.txt’ to ‘/tmp/newfile.txt’: Read-only file system
# 解决方案:重新挂载为读写模式
# mount -o remount,rw /tmp
Part05-风哥经验总结与分享
5.1 mv命令使用技巧总结
根据多年的Linux运维经验,总结mv命令的使用技巧:
# 1. 安全移动模式
# 创建一个安全的mv别名
alias mv=’mv -i -v’
# 2. 批量移动前先预览
# echo mv *.log /var/log/archive/
mv log1.log log2.log log3.log /var/log/archive/
# 确认无误后再执行
# mv *.log /var/log/archive/
# 3. 使用rsync替代mv进行大文件移动
# rsync -av –progress large_file.tar /target/
# 验证后再删除源文件
# rm large_file.tar
# 4. 移动前检查文件属性
# ls -ld source_dir
# stat source_dir
# mv source_dir /target/
# 5. 使用脚本记录移动操作
# cat > /usr/local/bin/safe_mv.sh << 'EOF'
#!/bin/bash
LOG_FILE="/var/log/mv_operations.log"
DATE=$(date '+%Y-%m-%d %H:%M:%S')
echo "[$DATE] mv $@" >> $LOG_FILE
/usr/bin/mv -v “$@” 2>&1 | tee -a $LOG_FILE
EOF
# chmod +x /usr/local/bin/safe_mv.sh
# 6. 移动后验证
# mv -v source.txt dest.txt && md5sum source.txt dest.txt
renamed ‘source.txt’ -> ‘dest.txt’
a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6 dest.txt
# 7. 使用mv命令实现文件轮转
# mv –backup=numbered app.log app.log
# ls -l app.log*
-rw-r–r–. 1 root root 1234 Apr 2 10:00 app.log
-rw-r–r–. 1 root root 1234 Apr 2 09:00 app.log.~1~
# 8. 批量移动并保持目录结构
# find /source -type f -name “*.txt” | while read file; do
dir=$(dirname “$file”)
mkdir -p “/dest/$dir”
mv -v “$file” “/dest/$file”
done
5.2 mv命令操作检查清单
在生产环境中使用mv命令时的检查清单: 学习交流加群风哥微信: itpux-com
- 确认源文件或目录存在
- 确认目标位置有足够的磁盘空间
- 确认对源文件和目标目录有相应权限
- 确认目标文件是否已存在
- 重要文件移动前先备份
- 使用-v参数确认操作过程
- 移动后验证文件完整性
- 记录移动操作日志
- 检查符号链接的有效性
- 确认文件未被占用
5.3 mv命令相关工具推荐
与mv命令相关的工具和替代方案:
# 1. rsync – 更强大的文件同步工具
# rsync -av source/ dest/
# 优点:支持增量同步、显示进度、支持远程传输
# 2. install – 安装文件并设置属性
# install -m 755 -o root -g root script.sh /usr/local/bin/
# 优点:可以同时设置权限和所有者
# 3. mmv – 批量移动/重命名工具
# mmv ‘*.txt’ ‘#1.bak’
# 优点:支持模式匹配批量重命名
# 4. rename – 批量重命名工具
# rename ‘s/\.txt$/.bak/’ *.txt
# 优点:支持正则表达式批量重命名
# 5. mvn – 增强版mv命令
# mvn source dest
# 优点:提供更多交互选项和确认
# 6. trash-cli – 命令行回收站
# trash-put file.txt
# 优点:可以恢复误删除的文件
# 7. fslint – 文件系统检查工具
# fslint /path/to/directory
# 优点:可以查找重复文件、空文件等
# 8. fdupes – 查找重复文件
# fdupes -r /path
# 优点:可以查找重复文件并删除
本文由风哥教程整理发布,仅用于学习测试使用,转载注明出处:http://www.fgedu.net.cn/10327.html
