> For the complete documentation index, see [llms.txt](https://abhav.gitbook.io/linux-tutorials/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://abhav.gitbook.io/linux-tutorials/zipping-and-unzipping-files.md).

# zipping and unzipping files

gzip, gunzip, tar

## gzip

gzip (GNU zip)  - used to compress individual files(single files only)

**Note: replaces original file with zipped file**

Usage ->

```sh
gzip [filename]
```

<figure><img src="https://3197044210-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwGS99FW5vqaPqYTGiSZC%2Fuploads%2FGZzxCNuid5wIqh3a0YqO%2FScreenshot%202024-01-16%20at%2010.47.03%E2%80%AFPM.png?alt=media&amp;token=a446a980-018b-49dc-bc4b-97f08454bac2" alt=""><figcaption></figcaption></figure>

## gunzip

By default it replaces the compressed file with decompressed file

```shell
gunzip [filename]
```

<figure><img src="https://3197044210-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwGS99FW5vqaPqYTGiSZC%2Fuploads%2FYkjoFRgyHNaTnncpBwOU%2FScreenshot%202024-01-16%20at%2010.51.46%E2%80%AFPM.png?alt=media&amp;token=d3a1542c-4a02-42b3-8d41-0da2078478f7" alt=""><figcaption></figcaption></figure>

### By using \`-k\` we can keep the original compressed file too

```
gunzip -k [filename]
```

<figure><img src="https://3197044210-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwGS99FW5vqaPqYTGiSZC%2Fuploads%2Fo9rJGtGY3F8k8PvuXpzG%2FScreenshot%202024-01-17%20at%2011.34.36%E2%80%AFPM.png?alt=media&amp;token=91c03cac-cf74-48bc-99df-dd0521c9605d" alt=""><figcaption></figcaption></figure>
