Development > Scripting and Bash

Random Passwords Anyone ?

<< < (4/4)

Another way to do this but without saving it as a function, eg; you will need to type it in each time.

Is to type into your terminal

--- Code: ---< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-32};echo;
--- End code ---

An example

Coz reverse stuff can be fun, lets do it in reverse -

--- Code: ---tr -cd '[:alnum:]' < /dev/urandom | fold -w30 | head -n1
--- End code ---

An example

More to come


here is a function for making random passwords. It works for the session you are in, and will need re-adding in a new session, eg you can close and open terminal and randpw will work but if you reboot you need to re-add the function.

--- Code: ---randpw(){ < /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-16};echo;}
--- End code ---

If you copy/paste this (or type it) into your terminal and hit enter.

Every time you need a new random password open your terminal and type

--- Code: ---randpw
--- End code ---

and it will generate one and save you having to type the entire function out again that session.

An example -

Be sure to save any random passwords you use somewhere safe, like the password locker/safe, didn't we used to have one of these in Linux Lite ?

I will post some other ways to do this soon.


[0] Message Index

[*] Previous page

Go to full version