zoukankan      html  css  js  c++  java
  • 操作文件和目录【TLCL】

    • cp – Copy files and directories

    • mv – Move/rename files and directories

    • mkdir – Create directories

    • rm – Remove files and directories

    • ln – Create hard and symbolic links

    通配符

    WildcardMeaning
    * Matches any characters
    ? Matches any single character
    [characters] Matches any character that is a member of the set characters
    [!characters] Matches any character that is not a member of the set characters
    [[:class:]] Matches any character that is a member of the specified class

    字符类

    Character ClassMeaning
    [:alnum:] Matches any alphanumeric character
    [:alpha:] Matches any alphabetic character
    [:digit:] Matches any numeral
    [:lower:] Matches any lowercase letter
    [:upper:] Matches any uppercase letter
    • mkdir directory...

    • cp item1 item2

    • cp item... directory

    OptionMeaning
    -a, --archive Copy the files and directories and all of their attributes, including ownerships and permissions. Normally, copies take on the default attributes of the user performing the copy
    -i, --interactive Before overwriting an existing file, prompt the user for confirmation. If this option is not specified, cp will silently overwrite files.
    -r, --recursive Recursively copy directories and their contents. This option (or the -a option) is required when copying directories.
    -u, --update When copying files from one directory to another, only copy files that either don't exist, or are newer than the existing corresponding files, in the destination directory.
    -v, --verbose Display informative messages as the copy is performed.
    • mv item1 item2
    • mv item... directory
    • rm item...

      先用 ls 命令来测试通配符

    • ln file link      硬链接
    • ln -s item link    符号链接

    硬链接不能关联文件系统之外的文件,不能关联目录

  • 相关阅读:
    python学习的第20天内置模块之sys、os、os下的path、random、shutil
    【数据结构】数组
    【INDEX】【C和C++】学习汇总
    【Spark】Spark环境配置
    【Scala】一些没有的关键字和声明
    【Scala】异常控制
    二叉树的最大深度
    回文链表
    环形链表
    删除链表的倒数第N个节点
  • 原文地址:https://www.cnblogs.com/songdechiu/p/9943910.html
Copyright © 2011-2022 走看看