Ubuntu Unleashed 2019 Edition: Covering 18.04, 18.10, 19.04

(singke) #1
The tar command can also    backup  over    multiple    floppy  disks:

Click here to view code image
matthew@seymour:~$ sudo tar czvMf /dev/fd0 /home


This    backs   up  the contents    of  /home   and spreads out the file    over    multiple
floppies, and you are prompted with this message:

Click here to view code image
Prepare volume #2 for '/dev/fd0' and hit return:


Restoring Files from an Archive with tar

The xp option with tar restores the files from a backup and preserves the
file attributes, as well, and tar creates 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 know where
they will be placed.


For example, to restore a tar archive compressed with bzip2, use the
following:


Click here to view code image
matthew@seymour:~$ sudo tar xjvf ubuntutest.tar.bz2


To list the contents of a tar archive compressed with bzip2, use this:


Click here to view code image
matthew@seymour:~$ sudo tar tjvf ubuntutest.tar.bz2
tar: Record size = 8 blocks


drwxr-xr-x  matthew/matthew                                 0   2013-07-08  14:58   other/

-rwxr-xr-x  matthew/matthew                     1856    2013-04-29  14:37   other/matthew
helmke
public.asc

-rwxr-xr-x  matthew/matthew                         170 2013-05-28  18:11   backup.sh

-rwxr-xr-x  matthew/matthew                     1593    2013-10-11  10:38   backup  method

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.

Free download pdf