Skip to main content

Timeline for cp vs. cat to copy a file

Current License: CC BY-SA 3.0

5 events
when toggle format what by license comment
Nov 24, 2019 at 4:46 comment added user309777 Btw, GNU cp has an option for controlling its behavior on sparse files; like, with --sparse=never specified on the command line, cp is as slow as cat.
Jan 30, 2012 at 15:47 comment added Tatjana Heuser Both tools operate on content, but cp (at least "modern" implementations) is aware of some specialities nowadays, like holes (old implementations of cat will run into that trap). There also are filesystems which are unaware of the concept of sparse files, for example HFS+ (MacOS) or FAT (MSDOS, USB-Sticks, etc), causing them to be blown up to their full size. So there are constellations where cp or cat won't make a difference in practice.
Jan 30, 2012 at 15:35 vote accept qyy
Jan 30, 2012 at 15:29 comment added qyy So cp makes a file just like the original, while cat creates a new file with the same content.
Jan 30, 2012 at 15:03 history answered Tatjana Heuser CC BY-SA 3.0