vlad ha revisionato questo gist 3 days ago. Vai alla revisione
1 file changed, 13 insertions, 6 deletions
tar.md
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | 5 | Basic syntax: | |
| 6 | 6 | ||
| 7 | - | ``` | |
| 7 | + | ```sh | |
| 8 | 8 | tar -cvf archive.tar file1 file2 dir/ | |
| 9 | 9 | ``` | |
| 10 | 10 | ||
| @@ -12,25 +12,25 @@ Common variants: | |||
| 12 | 12 | ||
| 13 | 13 | * Create compressed (gzip): | |
| 14 | 14 | ||
| 15 | - | ``` | |
| 15 | + | ```sh | |
| 16 | 16 | tar -czvf archive.tar.gz file1 dir/ | |
| 17 | 17 | ``` | |
| 18 | 18 | ||
| 19 | 19 | * Create compressed (xz, smaller but slower): | |
| 20 | 20 | ||
| 21 | - | ``` | |
| 21 | + | ```sh | |
| 22 | 22 | tar -cJvf archive.tar.xz file1 dir/ | |
| 23 | 23 | ``` | |
| 24 | 24 | ||
| 25 | 25 | * Create from entire directory: | |
| 26 | 26 | ||
| 27 | - | ``` | |
| 27 | + | ```sh | |
| 28 | 28 | tar -czvf archive.tar.gz myfolder/ | |
| 29 | 29 | ``` | |
| 30 | 30 | ||
| 31 | 31 | * Exclude something: | |
| 32 | 32 | ||
| 33 | - | ``` | |
| 33 | + | ```sh | |
| 34 | 34 | tar -czvf archive.tar.gz myfolder/ --exclude="*.log" | |
| 35 | 35 | ``` | |
| 36 | 36 | ||
| @@ -44,6 +44,13 @@ Flags: | |||
| 44 | 44 | ||
| 45 | 45 | ## Unarchive | |
| 46 | 46 | ||
| 47 | - | ``` | |
| 47 | + | ```sh | |
| 48 | 48 | tar -xf archive.tar.gz -C dest | |
| 49 | + | ``` | |
| 50 | + | ||
| 51 | + | ## See contents | |
| 52 | + | ||
| 53 | + | ```sh | |
| 54 | + | # -TheFuck :) | |
| 55 | + | tar -tf archive.tar.gz | |
| 49 | 56 | ``` | |
vlad ha revisionato questo gist 3 weeks ago. Vai alla revisione
1 file changed, 5 insertions, 1 deletion
tar.md
| @@ -42,4 +42,8 @@ Flags: | |||
| 42 | 42 | * `-z` gzip | |
| 43 | 43 | * `-J` xz | |
| 44 | 44 | ||
| 45 | - | If you want the reverse (extract), say it. | |
| 45 | + | ## Unarchive | |
| 46 | + | ||
| 47 | + | ``` | |
| 48 | + | tar -xf archive.tar.gz -C dest | |
| 49 | + | ``` | |
vlad ha revisionato questo gist 3 months ago. Vai alla revisione
Nessuna modifica
vlad ha revisionato questo gist 3 months ago. Vai alla revisione
1 file changed, 45 insertions
tar.md(file creato)
| @@ -0,0 +1,45 @@ | |||
| 1 | + | # Tar | |
| 2 | + | ||
| 3 | + | ## Create archive | |
| 4 | + | ||
| 5 | + | Basic syntax: | |
| 6 | + | ||
| 7 | + | ``` | |
| 8 | + | tar -cvf archive.tar file1 file2 dir/ | |
| 9 | + | ``` | |
| 10 | + | ||
| 11 | + | Common variants: | |
| 12 | + | ||
| 13 | + | * Create compressed (gzip): | |
| 14 | + | ||
| 15 | + | ``` | |
| 16 | + | tar -czvf archive.tar.gz file1 dir/ | |
| 17 | + | ``` | |
| 18 | + | ||
| 19 | + | * Create compressed (xz, smaller but slower): | |
| 20 | + | ||
| 21 | + | ``` | |
| 22 | + | tar -cJvf archive.tar.xz file1 dir/ | |
| 23 | + | ``` | |
| 24 | + | ||
| 25 | + | * Create from entire directory: | |
| 26 | + | ||
| 27 | + | ``` | |
| 28 | + | tar -czvf archive.tar.gz myfolder/ | |
| 29 | + | ``` | |
| 30 | + | ||
| 31 | + | * Exclude something: | |
| 32 | + | ||
| 33 | + | ``` | |
| 34 | + | tar -czvf archive.tar.gz myfolder/ --exclude="*.log" | |
| 35 | + | ``` | |
| 36 | + | ||
| 37 | + | Flags: | |
| 38 | + | ||
| 39 | + | * `-c` create | |
| 40 | + | * `-v` verbose (optional) | |
| 41 | + | * `-f` filename | |
| 42 | + | * `-z` gzip | |
| 43 | + | * `-J` xz | |
| 44 | + | ||
| 45 | + | If you want the reverse (extract), say it. | |