Blame
|
1 | # TAR |
||||||
| 2 | GNU 'tar' saves many files together into a single tape or disk archive, and can |
|||||||
| 3 | restore individual files from the archive. |
|||||||
| 4 | ||||||||
| 5 | ## Overview |
|||||||
| 6 | | Command | Description | |
|||||||
| 7 | | - | - | |
|||||||
| 8 | | `tar -czf backup_$(date + %F_%H-%M-%S).tar.gz <dir1> <dir2>` | Create <backup_file> with dir1 and dir2 as content | |
|||||||
| 9 | | - | - | |
|||||||
| 10 | | `tar -tzf <file>` | Show directories from proton | |
|||||||
| 11 | | - | - | |
|||||||
| 12 | | `tar -xzf <file> -C <dir to restore>` | Extract content from <file> into <dir to restore> | |
|||||||
|
13 | | `tar -xzf <file> --strip-components=2 -C <dir to restore>` | Extract content from <file> into <dir to restore> but ignores first 2 levels of directory structur | |
||||||
| 14 | ||||||||
| 15 | ## Meta Data |
|||||||
| 16 | :::info |
|||||||
| 17 | Tar per default saves meta data such as user and group rights |
|||||||
| 18 | ::: |
|||||||
| 19 | :::warning |
|||||||
| 20 | To correctly restore user and group rights do tar -xzf with **sudo** |
|||||||
| 21 | ::: |
|||||||
