In the below command which prints a 32 character length key why < command is placed at the beginning?
< /dev/urandom tr -dc A-Za-z0-9 | head -c32
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hello,
The tr command can read directly from stdin. So the two following expressions are more or less going to work in the same way:
< /dev/urandom tr -dc A-Za-z0-9 | head -c32
or
tr -dc A-Za-z0-9 < /dev/urandom | head -c32
Basically, the redirections can appear anywhere on a simple command.
An alternative approach is to use the cat command which is going to just add an extra step but produce the same result:
cat /dev/urandom | tr -dc A-Za-z0-9 | head -c32
Hope that this helps!
Best,
Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.