Tips tagged tar


3

Tip #740   Incremental backup with tar

The tar command can be used to make a quick incremental backup as follows:

Read more »

7

Tip #492   Moving large directories

Why not use cp or mv to move /usr/home to /storage/export/home? Weird things happen to hard and softlinks when you mv or cp. Try it and remember that a mv between different filesystems is actually a copy and delete.

Try this instead: Read more »

96

Tip #375   Bash function to decompress archives

From dotfiles.org; original author unknown:

Read more »

7

Tip #362   Tar remote dir over SSH

If you work on remote boxes a lot, you ll probably need a to backup a directory from there onto your machine sooner or later.. This can easilly be done using ssh & tar; all in 1 line of (script friendly) code:

Read more »

6

Tip #208   Pipe files to an archive

If you want to select specifically the files to add to an archive you can pipe the output from find (or any command that gives a list of files) to cpio:

Read more »

3

Tip #44   Using tar with other compression formats

GNU tar comes with native support for gzip, bzip2, and compress (adaptive LZ, LZW). However, many other useful compression algorithms exist, but most implementations of them don't support all the file system metadata that tar does. There are two general methods to using tar with arbitrary compression programs: via an option in tar itself and via piping. The first:
Read more »

46

Tip #78   network copy with ssh and tar

You can use ssh in conjunction with tar to pull an entire directory tree from a remote machine into your current directory:

ssh <username@sourcehost> tar cf - -C <sourcedir> . | tar xvf -

For example, let's say you have a "bsmith" account on a host called "apple". You want to copy those files into your "bobsmith" account on a host called "pear". You'd log into your "bobsmith@pear" account and type the following:

ssh bsmith@apple tar cf - -C /home/bsmith . | tar xvf -

This technique is useful when you have insufficient disk space on the source machine to make an intermediate tarball. Read more »