BASH - generate random string

Moki Lv6
1
cat /dev/urandom | tr -dc '[:alpha:]' | fold -w ${1:-20} | head -n 1
1
cat /dev/urandom | tr -dc '[:alpha:][:punct:]' | fold -w ${1:-20} | head -n 1

Classes:

ClassDescription
alnumAlphanumeric characters
alnumAlphanumeric characters
alphaAlphabetic characters
blankWhite space characters
cntrlControl characters
digitNumeric characters
graphGraphic characters
ideogramIdeographic characters
lowerLowercase alphabetic characters
phonogramPhonographic characters
printPrintable characters
punctPunctuation characters
runeValid characters
spaceSpace characters
specialSpecial characters
upperUppercase alphabetic characters
xdigitHexadecimal characters
On this page
BASH - generate random string