O'Reilly logo

Ubuntu Unleashed 2013 Edition: Covering 12.10 and 13.04, Eighth Edition by Matthew Helmke

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required