Generating a password with the Linux command line is very easy with data from /dev/urandom. This allows a user to retrieve random data easily. The example below shows a password being generated only using letters and numbers.
┌──[jason@192.168.1.2]─[~] └──╼ ╼ $ tr -dc "0-9A-Za-z" < /dev/urandom | head -c 96 ; echo gOApOMzRqqbmvUjxT7esfJcKW58PxxXqYDwCVvd628OsEa1yyfLADADJQ8YBZFdWZQkCXCRDKCPncSsC20OOjHxklnaxEbJF |
This part of the command line only selects upper and lowercase letters and numbers from the input. Then we can print the usable but very complicated password.
Below is another example, this generates a string using only hexadecimal characters.
┌──[jason@192.168.1.2]─[~] └──╼ ╼ $ tr -dc "0-9A-Fa-f" < /dev/urandom | head -c 32 ; echo bB9FF77B926daC93dCeF74E45A3A89FA |
This tip would be very useful for generating random passwords for any secure application.