---
title: 'Useful tips'
url: 'https://tucek.me/en/tech/useful-tips'
markdown: 'https://tucek.me/en/tech/useful-tips.md'
lang: en
date: '2026-09-09'
description: 'How to password protect gzip files on the command line? With openssl and tar Encrypt tar cz folder_to_encrypt | openssl enc -aes-256-cbc -salt -pbkdf2 -e > out.tar.gz.enc Decrypt openssl enc -aes-256-cbc -salt -pbkdf2 -d -in out.tar.gz.enc | tar xz With zip and unzip (less secure) Encrypt zip -r…'
---

# Useful tips

## How to password protect gzip files on the command line?

### With openssl and tar

Encrypt

```command
tar cz folder_to_encrypt | openssl enc -aes-256-cbc -salt -pbkdf2 -e > out.tar.gz.enc
```

Decrypt

```command
openssl enc -aes-256-cbc -salt -pbkdf2 -d -in out.tar.gz.enc | tar xz
```

### With zip and unzip (less secure)

Encrypt

```command
zip -r --encrypt archive.zip folder_to_encrypt
```

Decrypt

```command
unzip archive.zip
```

## Encrypt one file

Encrypt

```command
openssl enc -aes-256-cbc -salt -pbkdf2 -e -in filename.doc -out filename.enc
```

Decrypt

```command
openssl enc -aes-256-cbc -salt -pbkdf2 -d -in filename.enc -out filename.doc
```

---

## Navigation

- Parent: [Tech](https://tucek.me/en/tech.md)
- Previous: [Mobile phones](https://tucek.me/en/tech/mobile-phones.md)
- Children:
  - [USB disk with Linux](https://tucek.me/en/tech/useful-tips/usb-disk-with-linux.md)
  - [Debian trixie](https://tucek.me/en/tech/useful-tips/debian-trixie.md)
