翻译完成

This commit is contained in:
runningwater 2013-10-28 11:28:40 +08:00
parent 1650d4dbc7
commit dc91f25916

View File

@ -1,4 +1,4 @@
gcp 灵感来自CP的高级命令行文件拷贝工具 gcp 源于CP的高级命令行文件拷贝工具
================================================================================ ================================================================================
几周前,我们讨论了[高级拷贝][1](修改于cp命令让其可以显示复制进度条)。一位读者在注释中指出其他实用工具不仅也提供了基本的cp命令功能而且还提供cp不具有的高级功能。所以这篇文章里我们将会讨论非常相似的命令行工具**gcp**。 几周前,我们讨论了[高级拷贝][1](修改于cp命令让其可以显示复制进度条)。一位读者在注释中指出其他实用工具不仅也提供了基本的cp命令功能而且还提供cp不具有的高级功能。所以这篇文章里我们将会讨论非常相似的命令行工具**gcp**。
@ -42,80 +42,80 @@ gcp命令提供了进度显示功能以便用户能监控到复制操作的
**3. 精心设计的错误描述显示** **3. 精心设计的错误描述显示**
任何情况的错误gcp命令都会把导致拷贝失败的文件的信息显示出来。 任何情况的错误gcp命令都会把拷贝失败的文件的信息显示出来。
下面是例子: 下面是例子:
![](http://mylinuxbook.com/wp-content/uploads/2013/10/gcp-3.png) ![](http://mylinuxbook.com/wp-content/uploads/2013/10/gcp-3.png)
So you can see that the gcp command provided a detailed error message related to the file **August Rush.avi** that was already present inside the destination folder. But an error did not disrupt the copy of other file(s). 所以你可以看到gcp命令列出了详细的错误消息即关于**August Rush.avi**文件已经在目标目录中存在,拷贝失败。但这个错误并不会影响其它文件的正常拷贝操作。
**4. Get Detailed Output Through -v Option** **4. 使用-v选项输出详细信息**
The verbose option -v can be used to keep track of all the details that the gcp command is up to. 详细选项-v参数可以用来跟踪gcp命令执行时的所有详细消息。
Here is an example : 下面是例子:
![](http://mylinuxbook.com/wp-content/uploads/2013/10/gcp-4.png) ![](http://mylinuxbook.com/wp-content/uploads/2013/10/gcp-4.png)
So you can see that extended details were provided in output when -v option was used. 所以,你可以看到,使用-v选项可以输出很多细节信息。
**5. Create And Use Sources List** **5. 创建和使用源列表**
One of the shining features of the gcp command is that it lets you create a list of source files that you can use later. gcp命令的一个很炫的功能就是可以创建源文件列表以供后期使用。
For example, I saved the list of source file in the following copy operation using the option **sources-save**. 例如,在下面的拷贝操作中,我使用**-sources-save**选项来保存一个源文件列表。
![](http://mylinuxbook.com/wp-content/uploads/2013/10/gcp-5-1.png) ![](http://mylinuxbook.com/wp-content/uploads/2013/10/gcp-5-1.png)
The list name in this case is **SOURCES_SAVE**. You can confirm the saved list through **sources-list** option. 这例子的列表名叫做**SOURCES_SAVE**。你可以用**sources-list**选项参数来确认及查看保存的列表。
![](http://mylinuxbook.com/wp-content/uploads/2013/10/gcp-5-3.png) ![](http://mylinuxbook.com/wp-content/uploads/2013/10/gcp-5-3.png)
So you can see that a list named **SOURCES_SAVE** is saved. 那么你可以看到列表名**SOURCES_SAVE**已经保存上了。
Now, I deleted the files that I copied in the first step : 现在,删除我们在第一步中拷贝的文件:
![](http://mylinuxbook.com/wp-content/uploads/2013/10/gcp-5-2.png) ![](http://mylinuxbook.com/wp-content/uploads/2013/10/gcp-5-2.png)
and repeated the first step again but without mentioning the source file names. The option **sources-load** was use to load the source file names from the list **SOURCES_SAVE**. 重复第一步的操作,但不要加上源文件路径名,使用**sources-load**选项参数来从**SOURCES_SAVE**列表文件中加载源文件路径名。
![](http://mylinuxbook.com/wp-content/uploads/2013/10/gcp-5-4.png) ![](http://mylinuxbook.com/wp-content/uploads/2013/10/gcp-5-4.png)
So you can see that the gcp command picked up the source file names from the list **SOURCES_SAVE** and the copy process started normally. 所以你可以看到gcp命令从**SOURCES_SAVE**列表文件中读取源文件路径名,并且正常的执行拷贝操作。
Here are other options related to source file lists : 下面是关于源文件列表的其它选项参数:
![](http://mylinuxbook.com/wp-content/uploads/2013/10/gcp-5-5.png) ![](http://mylinuxbook.com/wp-content/uploads/2013/10/gcp-5-5.png)
The gcp command provides various other useful options. For complete list of options, read the [man page of gcp][3]. gcp命令还提供了各式名样的其它有用选项。要查看完整的选项请阅读[gcp帮助主页][3]。
### Download/Installation/Configuration ### ### Download/Installation/Configuration ###
Here are some of the important links related to the gcp command : 下面是关于gcp命令的一些主要链接站点
- [Home Page][4] - [主页][4]
- [Download Link][5] - [下载链接][5]
- [Another useful gcp Tutorial][6] - [另一篇很有用的gcp使用教程][6]
You can alternatively download and install the gcp command through command line package managers like yum, apt-get etc. Ubuntu users can also use Ubuntu software centre to download and install this utility. 你可以通过使用像yum、apt-get等的命令行包管理工具来下载和安装gcp命令。Ubuntu用户也可以使用Ubuntu软件中心来下载和安装这个工具。
### Pros ### ### 优点 ###
- Status bar and source lists are the USP of this utility. - 状态条显示和源文件列表是这个工具的核心。
- Skips the problematic file(s) but the copy operation is not hampered. - 出现有问题的文件会直接跳过,不会影响正常文件的复制操作。
- Usage is similar to that of the standard cp command. - 跟标准的cp命令的用法很相似。
### Cons ### ### 不足 ###
- While copying folders, it could be better if copy status of each file is displayed. - 在复制文件夹的时候,要是能显示每个文件的复制状态,那就更好了。
- Doesnt come pre-installed in most of the Linux distributions. - 在大多数Linux发行版本中没有预先安装。
### Conclusion ### ### 结论 ###
If you are fed up of waiting blindly while copying large files through standard cp command the gcp is a good alternative. System administrators will love the source list feature. Its a must have utility. 如果你厌倦了通过标准cp命令拷贝大量文件而无休止的等待的话gcp命令是个不错的选择。系统管理员会喜欢上源文件列表的功能的。它是必备工具。
**Have you ever used gcp or any other advanced cp-like command line utility? Share your experience with us.** **你曾经使用过gcp或者类cp的命令行工具吗可以把你的使用心得跟我们分享。**
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------