4.1.1.1 linux文件管理 :文件属性操作 :文件名称

4.1.1.1 linux文件管理 :文件属性操作 :文件名称

1.rename命令

比较复杂 - 简单的推荐mv

2.rename命令详解

Usage:
    rename [ -h|-m|-V ] [ -v ] [ -n ] [ -f ] [ -e|-E perlexpr]*|perlexpr
    [ files ]
Options:
    -v, -verbose(冗余)
            Verbose: print names of files successfully renamed.              ##打印成功重命名的文件name
    -n, -nono
            No action: print names of files to be renamed, but don't rename. ##不执行,打印文件 to be renamed , 单不执行
    -f, -force
            Over write: allow existing files to be over-written.             ##覆写:覆盖存在的文件
    -h, -help
            Help: print SYNOPSIS and OPTIONS.
    -m, -man
            Manual: print manual page.                                  
    -V, -version
            Version: show version number.                                    ##展示版本号
    -e      Expression: code to act on files name.                           ## 表达式:执行在name上的code             
            May be repeated to build up code (like "perl -e"). If no -e, the
            first argument is used as code.
    -E      Statement: code to act on files name, as -e but terminated by';’. 

3.mv命令

$ ls
dir1
$ mv dir1 dir
$ ls
dir

4.mv命令详解

Usage: mv [OPTION]... [-T] SOURCE DEST
  or:  mv [OPTION]... SOURCE... DIRECTORY
  or:  mv [OPTION]... -t DIRECTORY SOURCE...
Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.

Mandatory arguments to long options are mandatory for short options too.
      --backup[=CONTROL]       make a backup of each existing destination file
  -b                           like --backup but does not accept an argument
  -f, --force                  do not prompt before overwriting
  -i, --interactive            prompt before overwrite
  -n, --no-clobber             do not overwrite an existing file
If you specify more than one of -i, -f, -n, only the final one takes effect.
      --strip-trailing-slashes  remove any trailing slashes from each SOURCE
                                 argument
  -S, --suffix=SUFFIX          override 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
  -Z, --context                set SELinux security context of destination
                                 file to default type
      --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, off       never 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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值