Generating Password in Linux Terminal

Generating Password in Linux Terminal

Password needs to be strong and unique. There are a ton of Password generators out there, In both online and offline. But you can easily generate strong passwords in your Linux terminal.

There are multiple methods to generate passwords in the terminal. But I'll cover good and effective ways.

Method 1: Generating Password with GPG

Open the Terminal and run the following command

gpg --gen-random --armor 1 12

This will generate one password with 12 Characters. As you can see above we have mentioned 1 Password with 12 Characters. You can try changing the Numbers as you wish.

The generated password will be like this:

Method 2: Generating Password with OpenSSL

Generating a password with OpenSSL is too easy. You need the below command.

openssl rand -base64 12

This will generate one password with 12 characters, You can change the number as per your need.  The Generated password will be like this.

Method 3: Generating Password with Pwgen

The third method involves installing pwgen on your system. This can be installed easily on your system with the following command.

If you're using Ubuntu:

sudo apt install pwgen

If you're using Fedora:

dnf install -y pwgen

Once installed, You just have to run this command to generate a password

pwgen 12 1

It'll generate 1 password with 12 characters in it. You can change the 12 & 1 as per your choice.

The Generated Password will look something like this

If you want to generate 100s of Passwords with 12 characters you just have to pass this command.

pwgen 14

That's it for this article. With these above methods, we can easily generate secure passwords just with Linux Terminal.