Restoring Files from an Archive with tar

The xp option in tar will restore the files from a backup and preserve the file attributes as well, and tar will create any subdirectories it needs. Be careful when using this option because the backups might have been created with either relative or absolute paths. You should use the tvf option with tar to list the files in the archive before extracting them so that you will know where they will be placed.

For example, to restore a tar archive compressed with bzip2, sudo tar xjvf ubuntutest.tar.bz2

To list the contents of a tar archive compressed with bzip2, sudo tar tjvf ubuntutest.tar.bz2

drwxrwxr-x paul/paul -rw-rw-r— paul/paul

0 2003-09-04 18:15:05 ubuntutest/

163 2003-09-03 22:30:49

5Rubuntutest/ubuntu_screenshots.txt 840 2003-09-01 19:27:59


1485 2003-09-01 18:14:23 ubuntutest/style-sheet.txt 931 2003-09-01 19:02:00 ubuntutest/ubuntu TOC.txt

Note that because the pathnames do not start with a backslash, they are relative pathnames and will install in your current working directory. If they were absolute pathnames, they would install exactly where the paths state.

The GNOME File Roller

The GNOME desktop file archiving graphical application File Roller (file-roller) will view, extract, and create archive files using tar, gzip, bzip, compress, zip, rar, lha, and several other compression formats. Note that File Roller is only a front-end to the command-line utilities that actually provide these compression formats; if they are not installed, File Roller cannot use that format.


File Roller will not complain if you select a compression format that is not supported by installed software until after you attempt to create the archive. Install any needed compression utilities first.

File Roller is well-integrated with the GNOME desktop environment to provide convenient drag-and-drop functionality with the Nautilus file manager. To create a new archive, select Archive, New to open the New Archive dialog box and navigate to the directory where you want the archive to be kept. Type your archive's name in the Selection: /root text box at the bottom of the New Archive dialog box. Use the Archive type drop-down menu to select a compression method. Now, drag the files that you want to be included from Nautilus into the empty space of the File Roller window, and the animated icons will show that files are being included in the new archive. When you are done, a list of files will be shown in the previously blank File Roller window (see Figure 17.1). To save the archive, simply select Archive, Close. Opening an archive is as easy as using the Archive, Open dialog to select the appropriate archive file.

Figure 17.1. Drag and drop files to build an archive with the GNOME File


[View full size image]

r rofi-P.wfcijp.rlp

c ■

ftrchr,* 6dt l£«»i


NfW Opin

AM L^'tlt


Back FMMnd



^ LorHion: |'



- Sua


Put!* u



. -j cron.d leran.djJy _ ■ cron.haiirV

FDMW FiMff Fnldtr

-DP.yl >ai ap _f-la Syn*n



_j cran, mem Hfy


_. DIA-*



a crwi.-d ii-ùnJlOta^i










i HljK MttfllfrJ fc(III « r'liij IHHlgtlf (»in., 1

Was this article helpful?

0 0

Post a comment