summary refs log blame commit diff stats
path: root/test/testdir/textfile.txt
blob: 45a234976f5b26fe719202b6f2b91f952118e656 (plain) (tree)
1
2
3
4



                                                                                                                            
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
ommit/core/tar.html?id=94e429f914be777770cf8094d728008a5efcf6ff'>94e429f ^
e4b9fd6 ^
94e429f ^


















e4b9fd6 ^
94e429f ^

















e4b9fd6 ^
94e429f ^






e4b9fd6 ^

94e429f ^
88ad431 ^


94e429f ^


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130



                              
                          


           

                                            

 
                                              
 








                                                                            
                                                                                                          

                                                                                                     


















                                                                                
                                 
                               


                                








                            
                                                    













                                                                      
                                                            


















                                                                     
                                                  

















                                                                          
                                                    






                                                               

                                            
           


                                                        


                                                                                                                        
<!DOCTYPE html>
<html dir="ltr" lang="en">
    <head>
        <meta charset='utf-8'>
        <title>Tar</title>
    </head>
    <body>

        <a href="index.html">Tools Index</a>
        <h1>Tar</h1>


        <h2 id="tarbkup">1. Create Backup</h2>

        <p>To create a simple compressed tar;</p>

        <pre>
        $ tar -czvf tar_name.tar.gz /path/to/archive
        </pre>

        <p>Script
        <a href="scripts/backup-system.sh">core/scripts/backup-system.sh</a>
        use tldp
        <a href="http://tldp.org/LDP/lame/LAME/linux-admin-made-easy/server-backup.html">server backup</a>
        and
        <a href="http://tldp.org/LDP/lame/LAME/linux-admin-made-easy/server-restore.html">restore</a>
        as a reference.</p>

        <pre>
        #!/bin/sh

        echo -n "root directory you want backup (/mnt/): "
        read ROOT_DIR

        echo -n "where you want to save (/home/user): "
        read DEST_DIR

        echo -n "backup name (system_name): "
        read BCK_NAME

        echo $DES_DIR
        echo $ROOT_DIR

        tar --xattrs -zcpf $DEST_DIR/$BCK_NAME-`date '+%Y-%j-%H-%M-%S'`.tar.gz \
            --directory=$ROOT_DIR \
            --exclude=usr/ports \
            --exclude=usr/src \
            --exclude=var/run \
            --exclude=var/lock \
            --exclude=srv \
            --exclude=mnt \
            --exclude=home \
            --exclude=dev \
            --exclude=run \
            --exclude=tmp \
            --exclude=proc \
            --exclude=sys .
        </pre>

        <h2 id="tarview">2. View content of tar</h2>

        <p>List files inside tar;</p>

        <pre>
        $tar -tvf backup.tar.gz
        </pre>

        <p>To restore is better to use first t flag and then x,
        this prevents any --absolute-paths problem;<p>

        <pre>
        $ tar -ztvpf full-backup-11-November-2045.tar.gz &gt; file.lst
        </pre>

        <h2 id="tarextract">3. Extract content from tar</h2>

        <p>If you want to extrat to different directory;</p>

        <pre>
        $ tar xf full-backup-11-November-2045.tar.gz --directory=/mnt
        </pre>

        <p>If path is fine, extract everything;</p>

        <pre>
        $ tar --xattrs -xpvf full-backup-11-November-2045.tar.gz
        </pre>

        <p>Extract just one file;</p>

        <pre>
        $ tar --extract --file=core.tar.gz libidn#1.32-1.pkg.tar.gz
        </pre>

        <h2 id="taradd">4. Add content to tar</h2>

        <p>Only uncompressed tar can append files without having
        to extract and compress again.</p>

        <p>First create a tar with all files in the current directory;</p>

        <pre>
        $ tar cpf core.tar *.tar.gz
        </pre>

        <p>List files before appending new file and after;</p>

        <pre>
        $ tar -tvf core.tar
        $ tar --append --file=core.tar libidn#1.32-1.pkg.tar.gz
        $ tar -tvf core.tar
        </pre>

        <h2 id="tarrm">5. Remove content of tar</h2>

        <pre>
        $ tar -tvf core.tar
        $ tar --delete --file=core.tar libidn#1.32-1.pkg.tar.gz
        $ tar -tvf core.tar
        </pre>

        <a href="index.html">Tools Index</a>

        <p>
        This is part of the LeetIO System Documentation.
        Copyright (C) 2021
        LeetIO Team.
        See the file <a href="../fdl-1.3-standalone.html">Gnu Free Documentation License</a> for copying conditions.</p>
    </body>
</html>