May 21, 2018

Random Passwords

head -c8 /dev/random | uuencode -m - | sed -n '2s/=*$//;2p'

  • October 25, 1999
  • By James Andrews

This prints psuedo "random" characters, for use as a password, for instance. The head command gets 16 bytes from the random device, uuencode flattens out the data to convert control characters into printable ascii and the sed magic at the end just gives a short string with none of the fluff from uuencode.

Most Popular LinuxPlanet Stories

Sitemap | Contact Us