您的位置:首页 > 运维架构 > Linux

GUN/LINUX命令之 cp mv install

2015-12-12 15:21 555 查看
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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: