How to copy files in linux faster than cp

How to copy files in linux faster than cp

Tar pipe

  1. install the pv: sudo apt install pv
  2. tar cf - . | (cd /dst; tar xvf -)[1]
time tar cf - Mutation/Raw_VCF | (cd /media/Side/ken/; tar xvf -)
tar cf - Mutation/Raw_VCF  2.04s user 21.44s system 18% cpu 2:06.94 total
( cd /dst; tar xvf -; )  1.33s user 32.93s system 26% cpu 2:06.94 total

It only takes 2 minutes compared 12 minutes by cp.

Another commands such as pv can help you too, to monitor the progress of a copy between two directories, for example:

tar cf - . | pv | (cd /dst; tar xf -)

gcp

Only works for git repository.

gcp -rv ~/Music/* /data/music/ [1:1]


  1. Cesar Capillas, 2017: How to copy files in linux faster and safer than cp ↩︎ ↩︎

How to copy files in linux faster than cp

https://karobben.github.io/2022/09/14/Linux/cp/

Author

Karobben

Posted on

2022-09-14

Updated on

2024-01-11

Licensed under

Comments