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

你可能感兴趣的:(4.1.1.1 linux文件管理 :文件属性操作 :文件名称)