Comparison of GUNcp and tar file copy speeds

Source: Internet
Author: User
Article Title: Compare the speed of copying files between GUNcp and tar. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

The two commands are not familiar to anyone. But what is the faster processing speed? I have discussed CU and other forums. I have done some experiments. .. Practice, CP is faster.

Cao wrote a tar quick file copy tip.

# Cd/data/test1
# Tar-cf-. | (cd/data/test2; tar-xvpf -)

My simple practices:

1. Relative Path VS absolute path

[Code]
# Time tar-cf-. | (cd/tmp/test2/; tar-xvpf -)
./
./Linuxtone_2009_04_09.log.gz
./Linuxtone_2009_04_10.log.gz
./Linuxtone_2009_04_11.log.gz
./Linuxtone_2009_04_12.log

Real 0m3. 150 s
User 0m0. 108 s
Sys 0m1. 754 s
[/Code]

[Code]
Relative Path
# Time cp-r * ../test2/

Real 0m1. 167 s
User 0m0. 053 s
Sys 0m1. 065 s
[/Code]

Cp is 1.983 s faster than tar

[Code]
Absolute path
# Time cp-r */tmp/test2/

Real 0m1. 170 s
User 0m0. 070 s
Sys 0m1. 056 s
[/Code]
Cp is 1.98 s faster than tar

Ii. File Attributes

Some people say that cp cannot be copied together with the attributes of files and folders. Better than tar. In fact, man cp can see

-P same as -- preserve = mode, ownership, timestamps
-- Preserve [= ATTR_LIST]
Preserve the specified attributes (default: mode, ownership, timestamps) and security contexts, if possi-
Ble additional attributes: links, all

Because the directory contains files and folders, you can use

-A, -- archive
Same as-dpR

The test speed is not much different from the above speed. Cp is still faster than tar

3. If the cp does not see the progress, it can be as follows:

Cd/mnt/cdrom
For I in *
Do
Cp $ I target directory
Echo $ I is OK ....
Done


 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.