• GUN/LINUX命令之 cp mv install


    1. cp命令 复制copy命令的简写

    SYNOPSIS
           cp [OPTION]... [-T] SOURCE DEST

           cp [OPTION]... SOURCE... DIRECTORY
           cp [OPTION]... -t DIRECTORY SOURCE...

    cp  SOURCE  DEST   后者如果是目录那么源文件就复制到文件夹里面并且保持着原来的名字;如果DEST是文件名那么复制过来的文件的名字就修改成此文件名

    cp source…..directory    同时复制多个源那么目标只能是目录

    cp –t directory source …….  使用-t选项可以将目标和源的位置颠倒位置

    参数  -f   force  如果文件名存在那就删除文件然后复制,复制的时候也不提示覆盖

            -r   recursive   递归复制 linux的复制命令默认是不能复制目录的,所以必须使用此参数进行目录的复制

            -i   交互式提醒 

           -p   复制链接文件的原文件 

           -L  derefrence    只复制原文件

           -P 大写   复制链接文件还是链接,保持原有属性

          -a   archive   归档复制  保持文档的一切属性不变

    2.mv  移动命令  用法基本和cp类似

        不同点  1 重命名   mv  source dest   在同一目录中重命名一个原

                     2 没有递归选项  操作文件或者目录都可以正常操作

    3. install    不能复制目录,只能文件。复制的文件有权限,主要用于制作RPM包

    SYNOPSIS
           install [OPTION]... [-T] SOURCE DEST
           install [OPTION]... SOURCE... DIRECTORY
           install [OPTION]... -t DIRECTORY SOURCE...
           install [OPTION]... -d DIRECTORY...   

    DESCRIPTION
           This  install  program  copies  files (often just compiled) into destination locations you choose.  If you want to download and install a ready-to-use package on a GNU/Linux
           system, you should instead be using a package manager like yum(1) or apt-get(1).

           In the first three forms, copy SOURCE to DEST or multiple SOURCE(s) to the existing DIRECTORY, while setting permission modes and owner/group.  In the 4th form,  create  all
           components of the given DIRECTORY(ies).

           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

           -c     (ignored)

           -C, --compare
                  compare each pair of source and destination files, and in some cases, do not modify the destination at all

           -d, --directory
                  treat all arguments as directory names; create all components of the specified directories

                           创建目录

           -D     create all leading components of DEST except the last, then copy SOURCE to DEST

           -g, --group=GROUP
                  set group ownership, instead of process’ current group

           -m, --mode=MODE
                  set permission mode (as in chmod), instead of rwxr-xr-x

           -o, --owner=OWNER
                  set ownership (super-user only)

           -p, --preserve-timestamps
                  apply access/modification times of SOURCE files to corresponding destination files

  • 相关阅读:
    教你不编程快速解析 JSON 数据
    教你在 Linux 下时光穿梭
    在Linux系统中使用Vim读写远程文件
    【高并发】如何实现亿级流量下的分布式限流?这些理论你必须掌握!!
    【高并发】高并发环境下构建缓存服务需要注意哪些问题?我和阿里P9聊了很久!
    【高并发】关于线程池,蚂蚁金服面试官问了我这些内容!!
    【高并发】关于乐观锁和悲观锁,蚂蚁金服面试官问了我这几个问题!!
    机器学习 | 简介推荐场景中的协同过滤算法,以及SVD的使用
    Python | Python初学者的自我修养,找到自己的方向
    LeetCode 86 | 链表基础,一次遍历处理链表中所有符合条件的元素
  • 原文地址:https://www.cnblogs.com/gailuo/p/5041299.html
Copyright © 2020-2023  润新知