Friday, February 05, 2010

Simple Password Generator

Edit this file .bashrc at your home dir.
sudo vi /home/harith/.bashrc

add following script at the end
genpasswd() {
local l=$1
[ "$l" == "" ] && l=20
tr -dc A-Za-z0-9_ < /dev/urandom | head -c ${l} | xargs }
Open your terminal and run this command to generate random password

genpasswd 16

Example:

harith@thinkmachine:~$ genpasswd 16
Br1WleFsmhJ4Dkwb
harith@thinkmachine:~$

0 comments: