This content originally appeared on DEV Community and was authored by Alberto Gonzalez Escalante
Problem
Simple and easy method for generating random passwords from the command line.
Solution
Use the command below:
LC_ALL=C </dev/urandom tr -cd '[:alnum:]' | head -c 32
Explanation
This command generates a random string, remove non-alphanumeric characters and print the first 32 characters.
Adjust the length of the password by changing the number after -c in head -c 32.
Add symbols by replacing the character class with [:graph:] as in tr -cd '[:graph:]'.
This content originally appeared on DEV Community and was authored by Alberto Gonzalez Escalante
Alberto Gonzalez Escalante | Sciencx (2025-10-21T09:26:35+00:00) Generate passwords from CLI. Retrieved from https://www.scien.cx/2025/10/21/generate-passwords-from-cli/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.