Friday, May 26, 2017

tar/untar vs copy




tar is faster in most cases when compared to copy:


// directory copy
# tar cf - directory_to_copy/  |  tar xfp -  -C  /myowntarget/

// few files copy
# tar cf - file1 file2 file3   |  tar xfp -  -C  /myowntarget/

// copy all
# tar cf  - *   |  tar xfp -  -C  /myowntarget/ 


- in first tar is "stdout"  which is fed as input to "|"  pipe , extracted again by tar where target directory specified by -C


Some interesting discussion here:

https://superuser.com/questions/788502/why-is-tartar-so-much-faster-than-cp
https://stackoverflow.com/questions/316078/interesting-usage-of-tar-but-what-is-happening


No comments:

Post a Comment