Generating Random Passwords from the Command Line in Linux
Generating Random Passwords from the Command Line in Linux
—
You can use next command for generating random password in command line:
# tr -dc A-Za-z0-9 < /dev/urandom | head -c 8 | xargs
Password example:
4fFUND1d
Also you can use next bash function (add it to yuor ~/.bashrc):
Random Password Generator
genpasswd() {
tr -dc A-Za-z0-9 < /dev/urandom | head -c ${1:-8} | xargs
}
tr -dc A-Za-z0-9 < /dev/urandom | head -c ${1:-8} | xargs
}
Reboot .bashrc:
$ . ~/.bashrc
Now use genpasswd to generate random passwords:
$ genpasswd
vmuWt7TS
$ genpasswd 10
ymkIgxcdCh
$ genpasswd 16
wQnqgdc5tAQoiBdf
vmuWt7TS
$ genpasswd 10
ymkIgxcdCh
$ genpasswd 16
wQnqgdc5tAQoiBdf