# The Ubuntu Forum Community > Ubuntu Official Flavours Support > New to Ubuntu > [ubuntu] how to zip files

## Andrew U.K.

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

----------


## OutOfReach

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

----------


## p221072

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

----------


## dualpretop

Good program - PeaZip!

http://www.kde-apps.org/content/show...dd8a715c706d20

Download:
http://sourceforge.net/project/downl...use_mirror=dfn

----------


## Mornedhel

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.

----------


## myidbe

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

Example:


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

----------


## WRDN

*Creation*

To create a tar containing "files":



```
tar cf file.tar files
```

To create a tar with Gzip compression:



```
tar czf file.tar.gz files
```

To create a tar with Bzip2 compression:



```
tar cjf file.tar.bz2 files
```

*Extraction*

To extract files from tar:



```
tar xf file.tar
```

To extract files from tar using Gzip:



```
tar xzf file.tar.gz
```

To extract files from tar using Bzip2:



```
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).

----------


## HousieMousie2

WRDN,

Nicely done, covered a lot of bases, thanks.  This page is now bookmarked!

----------


## pudgypaw

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

$ zip -r destination.zip cowfile/

----------


## Mat11

> *Creation*
> 
> To create a tar containing "files":
> 
> 
> 
> ```
> tar cf file.tar files
> ```
> ...





```
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]

----------


## linxiarain

Thanks a lot.

----------

