Copying Files Using tar
One choice for copying files into another location is to use the tar command; you just create a tar file that is piped to tar to be uncompressed in the new location. To accomplish this, first change to the source directory. Then the entire command resembles this:
matthew@seymour:~$ tar -cvf files | (cd target_directory ; tar -xpf)
In this command, files are the filenames you want to include; use * to include the entire current directory.
Here is how this command works: You have already changed to the source directory and executed tar with the cvf arguments that tell tar to
• c—Create an archive.
• v—Verbose; lists the files processed so you can see that it is working.
• f—The filename of the archive will be what follows. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access