Generate Random Password on Linux

Linux has all the tools you need to generate a random password. This can be accomplished by a special file /dev/random, that serves as a random number generator.

The Linux random number generator gathers environmental noise from device drivers and other sources into an entropy pool. To generate passwords based on the random number generator, try running the following commands on a Linux machine.

This method will generate a 8-character random password:

 
ibrahim@anfield-vm:~$ cat /dev/urandom | tr -dc "a-zA-Z0-9@#*=[]" | head -c8

This method uses the dd command to output the password.

 
ibrahim@anfield-vm:~$ dd if=/dev/urandom bs=1 count=128 2>/dev/null | tr -dc "a-zA-Z0-9@#*=[]" | head -c8

ibrahim = { interested_in(unix, linux, android, open_source, reverse_engineering); coding(c, shell, php, python, java, javascript, nodejs, react); plays_on(xbox, ps4); linux_desktop_user(true); }