Create a Bash function to open random man pages
If your idea of fun is to read man pages, then today is your lucky day!
Here is a "cool" bash function that allows you to read random man pages whenever you want.
Get ready to learn all the things!
Well all the things there are man pages for... and in random order with no method behind the madness...
Just add the following to your .bashrc
file in your users home directory.
function rmp() {
random_man=$(man -k . | awk '{print $1}' | sort -R | tail -1)
man ${random_man}
unset random_man
}
Once you've added that to your .bashrc
, you can either type bash
in your terminal to open a new session.
Or, you can type source ~/.bashrc
to have your current session reload the .bashrc
file.
Then just type: rmp
to open a random man page and read to your heart's content.
Thanks!
Luke