一、cp命令

Linux中的复制命令。

复制文件:

wang@wang:~/workpalce/python$ tree
.
├── .txt
├── dir
└── module directories, file
wang@wang:~/workpalce/python$ cp .txt module/
wang@wang:~/workpalce/python$ tree
.
├── .txt
├── dir
└── module
└── .txt directories, files

复制目录:

wang@wang:~/workpalce/python$ tree
.
├── .txt
├── dir
└── module
└── .txt directories, files
wang@wang:~/workpalce/python$ cp module/ dir/ -r
wang@wang:~/workpalce/python$ tree
.
├── .txt
├── dir
│   └── module
│   └── .txt
└── module
└── .txt directories, files

二、mv命令

mv命令可以作为Linux中的剪切命令,也可以给文件或者文件夹重命名。

剪切文件:

wang@wang:~/workpalce/python$ tree
.
├── .txt
├── dir
└── module directories, file
wang@wang:~/workpalce/python$ mv .txt module/
wang@wang:~/workpalce/python$ tree
.
├── dir
└── module
└── .txt directories, file

剪切文件夹:

wang@wang:~/workpalce/python$ tree
.
├── dir
└── module
└── .txt directories, file
wang@wang:~/workpalce/python$ mv module/ dir/
wang@wang:~/workpalce/python$ tree
.
└── dir
└── module
└── .txt directories, file

文件重命名:

wang@wang:~/workpalce/python$ tree
.
├── .txt
└── module directory, file
wang@wang:~/workpalce/python$ mv .txt .txt
wang@wang:~/workpalce/python$ tree
.
├── .txt
└── module directory, file

文件夹重命名:

wang@wang:~/workpalce/python$ tree
.
├── .txt
└── module directory, file
wang@wang:~/workpalce/python$ mv module/ dir
wang@wang:~/workpalce/python$ tree
.
├── .txt
└── dir directory, file

三、注意

cp文件夹时需要-r参数,mv文件夹时不需要-r参数。

Linux 常用命令六 cp和mv的更多相关文章

  1. Linux常用命令之cp、mv、rm、cat、more、head、tail、ln命令讲解

    上一章节中,我们了解到了Linux系统的最基础的几个文件处理命令,核心的是ls命令,在今天这章中,我们来继续学习Linux对于文件操作相关的一些命令,比如复制.移动.删除.查看等命令. 1.cp 命令 ...

  2. linux常用命令:cp 命令

    cp命令用来复制文件或者目录,是Linux系统中最常用的命令之一.一般情况下,shell会设置一个别名,在命令行下复制文件时,如果目标文件已经存在,就会询问是否覆盖,不管你是否使用-i参数.但是如果是 ...

  3. linux常用命令(7)cp命令

    cp命令用来复制文件或者目录,是Linux系统中最常用的命令之一.一般情况下,shell会设置一个别名,在命令行下复制文件时,如果目标文件已经存在,就会询问是否覆盖,不管你是否使用-i参数.但是如果是 ...

  4. linux常用命令系列—cp 复制文件与文件夹

    原文地址:http://blog.chinaunix.net/xmlrpc.php?r=blog/article&uid=2272&id=37363 指令名称:cp(copy)功能介绍 ...

  5. 测试必知必会系列- Linux常用命令 - cp

    21篇测试必备的Linux常用命令,每天敲一篇,每次敲三遍,每月一循环,全都可记住!! https://www.cnblogs.com/poloyy/category/1672457.html 复制文 ...

  6. 测试必知必会系列- Linux常用命令 - mv

    21篇测试必备的Linux常用命令,每天敲一篇,每次敲三遍,每月一循环,全都可记住!! https://www.cnblogs.com/poloyy/category/1672457.html 移动当 ...

  7. Linux常用命令速查备忘

    Linux常用命令速查备忘   PS:备忘而已,详细的命令参数说明自己man 一. 启动,关机,登入,登出相关命令 [login] 登录 [logout] 登出 [exit] 登出 [shutdown ...

  8. [置顶] linux常用命令手册

    前言:整理了一份linux常用命令手册,与大家分享.这是一些比较常用的命令. 我已经整理成一份PDF带书签的手册,可以到CSDN免费下载. 下载地址:http://download.csdn.net/ ...

  9. Linux常用命令 笔记

     Linux常用命令  笔记 一.文件处理命令 1. ls命令:显示目录文件                          -a 显示所有文件,包括隐藏文件.(all)               ...

随机推荐

  1. HUNAN 11567 Escaping (最大流)

    http://acm.hunnu.edu.cn/online/?action=problem&type=list&courseid=0&querytext=&pagen ...

  2. Cooking Schedule Problem Code: SCHEDULE(优先队列)

    Cooking Schedule Problem Code: SCHEDULE Chef is a well-known chef, and everyone wishes to taste his ...

  3. [Bzoj1821][JSOI2010]Group 部落划分 Group(并查集)(二分答案)

    1821: [JSOI2010]Group 部落划分 Group Time Limit: 10 Sec  Memory Limit: 64 MBSubmit: 2949  Solved: 1392[S ...

  4. Java中@SuppressWarnings注解用法(转)

    背景: J2SE提供的最后一个注解是@SuppressWarnings.该批注的作用是给编译器一条指令,告诉它对被批注的代码元素内部的某些警告保持静默. @SuppressWarnings注解允许您选 ...

  5. Navicat for MySQL出现#1045 错误怎么办

    #1045 - Access denied for user 'root'@'localhost' (using password: NO)这是因为你连接的时候没有密码或者密码没改对导致的.如下图所示 ...

  6. spring理解一

    spring基本工作原理例如以下: 1.查找bean配置文件 2.载入bean配置文件并解析生成中间表示BeanDefinition 3.注冊beanDefinition 4.假设是单例或lazy-i ...

  7. Android 四大组件学习之Service五

    本节学习IntentService, 可能就有人问了. 什么是IntentService, IntentService有什么作用? 不是已经有了Service,那为什么还要引入IntentServic ...

  8. NoSQL之Redis探析

    下载地址:wget http://download.redis.io/releases/redis-2.8.8.tar.gz安装steps:1 下载Official Website : http:// ...

  9. 关于 iOS 的 StoryBoard,接受的那一刻才发现她的美 - 当然美的事物都须要业心照料

    关于 iOS 的 StoryBoard,接受的那一刻才发现她的美 - 当然美的事物都须要业心照料 太阳火神的漂亮人生 (http://blog.csdn.net/opengl_es) 本文遵循&quo ...

  10. A Simple Example About Privileged Methods in JavaScript

    Douglas Crockford classified the "class methods" in JavaScript into three types: private, ...