Paste the following code in ~/.bashrc :
# vi .bashrc
genpasswd() {
local l=$1
[ “$l” == “” ] && l=20
tr -dc A-Za-z0-9_ < /dev/urandom | head -c ${l} | xargs
}
Run it by typing :
genpasswd [no. of characters required]
Eg. genpasswd 16
By default, if you do not specify the no. of characters, it will print 20 characters.
You can use this set as a password.