This is a very interesting bash trick I found using ls. This runs the ls command with random parameters. This is not very useful, but interesting nonetheless.
4.4 Tue Mar 03 jason@Yog-Sothoth 0: $ ls -`cat /dev/urandom | tr -dc 'hula' | head --bytes 1` |
This is another example, this does work very well.
4.4 Tue Mar 03 jason@Yog-Sothoth 0: $ ls -`cat /dev/urandom | tr -dc 'hula' | head --bytes 3` total 24 drwxr-xrwx+ 2 jason jason 4096 Mar 3 10:07 . drwxr-xr-x+ 52 jason jason 12288 Mar 3 10:06 .. -rw-r--rw- 1 jason jason 6590 Aug 28 2019 user.ltx |
I do not know why you would use this, but this is an interesting trick nonetheless. I just wish I could use tr without cat. But what can you do?
Using the tr command like this, all of the letters are jumbled up into a random string.
tr -dc 'hula' |
This could be used to generate a very complicated password though…
4.4 Tue Mar 03 jason@Yog-Sothoth 0: $ cat /dev/urandom | tr -dc '[a-zA-Z0-9]' | head --bytes 36 qXKM8ZHm2wD5smNtRCtj7M0pilxGrBti5yFX |