• GNU coreutils


      内核实用程序,针对文本及文件操作。涉及到102条linux命令。
    命令列表:cpinstall、ln、mvlsecho……

     
    常见选项


    1.退出状态

     

    2.备份选项

      cp, install, ln, mv

    短选项长选项注解
    -b '--backup'[=method] 当某个文件存在被移动(mv)、覆盖的情况时,如何备份的指定选项。
    短选项不接受任何参数,默认是“--backup=existing“。
    -S SUFFIX --suffix=SUFFIX 与“-b”同时使用,添加到文件名中。

     

      当不指定“method”,有点复杂,建议指定。参数接受“唯一性缩写”、多字符表示,参数如下:

    METHOD参数注解

    none

    off

    永不备份

    numbered

    t

    总是进行编号备份

    existing

    nil

    已有的编号备份,其他的简单备份

    simple

    never

    简单备份

     

     

    3.目标目录

      cp, install, ln, mv

    短选项长选项注解
    -T File --no-target-directory

    指定普通文件,父目录必须是存在的。格式:install -T large.cnf /etc/my.cnf
    效果,就像复制后重命名,目标在最后且是个普通文件。

    -t DIR --target-directory=DIR

    指定目录文件,该目录必须存在。格式:install -t /etc my.cnf

    像是复制进去一样,目标在前,且是目录。

      例子,使用“-T”:

    [root@right mag]# ll
    total 0
    drwxr-xr-x. 2 root root 6 Dec 30 11:11 back
    drwxr-xr-x. 2 root root 6 Dec 30 11:11 mag
    [root@right mag]# mv -T mag back
    mv: overwrite ‘back’? y
    [root@right mag]# ll
    total 0
    drwxr-xr-x. 2 root root 6 Dec 30 11:11 back

      例子,使用“-t”:

    [root@right mag]# ll
    total 0
    drwxr-xr-x. 2 root root 6 Dec 30 11:11 back
    drwxr-xr-x. 2 root root 6 Dec 30 11:17 mag
    [root@right mag]# mv -t mag back
    [root@right mag]# ll
    total 0
    drwxr-xr-x. 3 root root 17 Dec 30 11:17 mag
    [root@right mag]# ls mag/
    back

      使用“-t”,效果等同于:

    [root@right mag]# ll
    total 0
    drwxr-xr-x. 2 root root 6 Dec 30 11:11 back
    drwxr-xr-x. 2 root root 6 Dec 30 11:20 mag
    [root@right mag]# mv back mag
    [root@right mag]# ll
    total 0
    drwxr-xr-x. 3 root root 17 Dec 30 11:20 mag
    [root@right mag]# ls mag/
    back
    一切代码都是为了生活,一切生活都是调剂
  • 相关阅读:
    bat windows批处理 移动所有子目录文件
    Oracle常见的QA
    [转载]行动起来
    [转载]微笑
    Excel数据更新至Mysql数据库
    sql server QA
    关于SharpZipLib的压缩与解压问题
    整合Spring.net到asp.net网站开发中初探
    设计模式概要
    Oracle 常用语句档案(二)
  • 原文地址:https://www.cnblogs.com/argor/p/7918707.html
Copyright © 2020-2023  润新知