Bash tricks

The page calls "Bash tricks" but it also contains a useful commands.

##

I call this 'diskspace killer'. Depends of your hardware it creates a huge sized file. Just run it for few secons to know its capability

yes "some text" > file.txt

##

Russian rullet

[ $[ $RANDOM % 6 ] == 0 ] && echo "You died" || echo "Still alive"

You may replace "echo "You died"" with "rm -rf /" for more fun ๐Ÿ™‚

PS. but don't if you understand nothing here)

##

Rename to a file with a prefix _old.

mv /home/username/somelongfilename{,_old}

Instead of running

mv /home/username/somelongfilename  /home/username/somelongfilename_old

##

This will update file's date to "Jun  7  1984 "

touch -d 19840607 testfile.txt

##

Temporary alias

alias ll='ls -la'

##




##

Generate a random numbers:

openssl rand -hex 12

openssl rand -base64 12

##