• Compressing with gzip
  • L in u X ba sics for h acke rs g e t t I n g s t a r t e d w I t h




    Download 7,3 Mb.
    Pdf ko'rish
    bet96/115
    Sana27.11.2023
    Hajmi7,3 Mb.
    #106243
    1   ...   92   93   94   95   96   97   98   99   ...   115
    Bog'liq
    linuxbasicsforhackers

    Compressing Files
    Now we have one archived file, but that file is bigger than the sum of the 
    original files. What if you want to compress those files for ease of transport? 
    Linux has several commands capable of creating compressed files. We will 
    look at these:

    gzip
    , which uses the extension .tar.gz or .tgz

    bzip2
    , which uses the extension .tar.bz2

    compress
    , which uses the extension .tar.z
    These all are capable of compressing our files, but they use different 
    compression algorithms and have different compression ratios. Therefore, 
    we’ll look at each one and what it’s capable of.
    In general, 
    compress
    is the fastest, but the resultant files are larger
    bzip2
    is the slowest, but the resultant files are the smallest; and 
    gzip
    falls some-
    where in between. The main reason you, as a budding hacker, should know 
    all three methods is that when accessing other tools, you will run into vari-
    ous types of compression. Therefore, this section shows you how to deal 
    with the main methods of compression.
    Compressing with gzip
    Let’s try 
    gzip
    (GNU zip) first, as it is the most commonly used compression 
    utility in Linux. You can compress your HackersArise.tar file by entering the 
    following (making sure you’re in the directory that holds the archived file):
    kali >gzip HackersArise.*
    Notice that we used the wildcard 
    *
    for the file extension; this tells Linux 
    that the command should apply to any file that begins with HackersArise with 
    any file extension. You will use similar notation for the following examples. 
    When we do a long listing on the directory, we can see that HackersArise.tar
    has been replaced by HackersArise.tar.gz, and the file size has been com-
    pressed to just 3,299 bytes!
    kali >ls -l
    --snip--
    -rw-r--r-- 1 root root 3299 Nov 27 2018 13:32 HackersArise.tar.gz
    --snip--
    We can then decompress that same file by using the 
    gunzip
    command, 
    short for GNU unzip.


    Compressing and Archiving

    Download 7,3 Mb.
    1   ...   92   93   94   95   96   97   98   99   ...   115




    Download 7,3 Mb.
    Pdf ko'rish

    Bosh sahifa
    Aloqalar

        Bosh sahifa



    L in u X ba sics for h acke rs g e t t I n g s t a r t e d w I t h

    Download 7,3 Mb.
    Pdf ko'rish