Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: how to zip files

  1. #1
    Join Date
    Aug 2008
    Location
    U.K.
    Beans
    74

    how to zip files

    Hi,

    How do I zip a file so I can add it to a forum post?
    I´ve done it once and can´t for the life of me work it out again. I did it in the terminal with a simple command.

    Cheers
    Andrew

  2. #2
    Join Date
    Jun 2008
    Location
    California, USA
    Beans
    1,030
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: how to zip files

    You can right click on the file and press 'Create Archive'.
    You can also do it from the terminal, I just forget the commands.

    Blog | I'm available for programming contributions. C & Python.
    Intel Core i7 920 | EVGA x58 SLI | NVidia GeForce 8600 GT | WD 500GB HDD | Corsair XMS3 3GB | Ubuntu 9.04

  3. #3
    Join Date
    Mar 2006
    Location
    Ireland
    Beans
    51
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: how to zip files

    Hi, you can use gzip command to compress and gunzip to exctract.
    Type man gzip to read all the options.
    You can also use the tar command to create [/exctract] an archive, using the -z option to compress the archive

  4. #4
    Join Date
    Aug 2008
    Beans
    44

  5. #5
    Join Date
    Oct 2006
    Location
    Lyon, France
    Beans
    839
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: how to zip files

    Better program - 7zip ('cause it's in the repositories, and integrates with file-roller).

    If you're overwhelmed by the complexity of tar+gzip, you can also use zip to produce the .zip archives common in the Windows world.
    This is the first age that's paid much attention to the future, which is a little ironic since we may not have one.
    -- Arthur C. Clarke

  6. #6
    Join Date
    Apr 2007
    Location
    Herrenberg, Germany
    Beans
    19
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: how to zip files

    You can also use the zip (and unzip) commands.

    Example:
    Code:
    malcolm@espresso:~/Desktop$ zip zipfile.zip file_i_want_to_zip.txt

  7. #7
    Join Date
    May 2008
    Location
    Beverley, UK
    Beans
    733
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: how to zip files

    Creation

    To create a tar containing "files":

    Code:
    tar cf file.tar files
    To create a tar with Gzip compression:

    Code:
    tar czf file.tar.gz files
    To create a tar with Bzip2 compression:

    Code:
    tar cjf file.tar.bz2 files
    Extraction

    To extract files from tar:

    Code:
    tar xf file.tar
    To extract files from tar using Gzip:

    Code:
    tar xzf file.tar.gz
    To extract files from tar using Bzip2:

    Code:
    tar xjf file.tar.bz2
    For a tar, "f" is used, for Gzip "zf" is used, and for Bzip2 "jf" is used. Place a "c" before each of those to use the compression, and an "x" to extract from the compressed file(s).
    Everything that has a Beginning, has an End

  8. #8
    Join Date
    Nov 2007
    Location
    Texas
    Beans
    265
    Distro
    Xubuntu

    Re: how to zip files

    WRDN,

    Nicely done, covered a lot of bases, thanks. This page is now bookmarked!
    "There is a principle which is a bar against all information, which is proof against all arguments and which cannot fail to keep a man in everlasting ignorance - That principle is contempt prior to investigation."
    Herbert Spencer

  9. #9
    Join Date
    Sep 2006
    Location
    LA, USA
    Beans
    11
    Distro
    Ubuntu Studio 12.04 Precise Pangolin

    Re: how to zip files

    as an aside, if you want to zip the file and all the subdirectories under it, use [-r]:

    $ zip -r destination.zip cowfile/

  10. #10
    Join Date
    Nov 2009
    Beans
    93
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: how to zip files

    Quote Originally Posted by WRDN View Post
    Creation

    To create a tar containing "files":

    Code:
    tar cf file.tar files
    To create a tar with Gzip compression:

    Code:
    tar czf file.tar.gz files
    To create a tar with Bzip2 compression:

    Code:
    tar cjf file.tar.bz2 files
    Extraction

    To extract files from tar:

    Code:
    tar xf file.tar
    To extract files from tar using Gzip:

    Code:
    tar xzf file.tar.gz
    To extract files from tar using Bzip2:


    My terminal just went crazy adding in laptop twice command line which i didn't type in in the first place where did the tar xflattop come from i have not entered that at all ??????
    The only entry i made was the tar xvjf ...bz2 i feel i have no control over my terminal at the moment got any idea ????
    thanks

    laptop:~$ tar xflaptop:~$ tar xvjf naev-0.4.2.tar.bz2
    tar: You may not specify more than one `-Acdtrux' option
    Try `tar --help' or `tar --usage' for more information.
    matt@matt-laptop:~$ tar: naev-0.4.2.tar.bz2: Cannot open: No such file or directory
    No command 'tar:' found, did you mean:
    Command 'tar' from package 'tar' (main)
    Command 'tart' from package 'tart' (universe)
    tar:: command not found
    matt@matt-laptop:~$ tar: Error is not recoverable: exiting now
    No command 'tar:' found, did you mean:
    Command 'tar' from package 'tar' (main)
    Command 'tart' from package 'tart' (universe)
    tar:: command not found
    matt@matt-laptop:~$ tar: Child returned status 2
    No command 'tar:' found, did you mean:
    Command 'tar' from package 'tar' (main)
    Command 'tart' from package 'tart' (universe)
    tar:: command not found


    Code:
    tar xjf file.tar.bz2
    For a tar, "f" is used, for Gzip "zf" is used, and for Bzip2 "jf" is used. Place a "c" before each of those to use the compression, and an "x" to extract from the compressed file(s).

    Code:
    tar xjf file.tar.bz2
    For a tar, "f" is used, for Gzip "zf" is used, and for Bzip2 "jf" is used. Place a "c" before each of those to use the compression, and an "x" to extract from the compressed file(s).[/QUOTE]

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •