$ for i in {0..255}; do echo -e "\e[38;05;${i}m${i}"; done | column -c 80 -s ' '; echo -e "\e[m"
I like the other three versions but one uses nested loops and another prints every color on a separate line. Both versions fail to reset colors before giving the prompt back.
This version uses the column command to print a table so all the colors fit on one screen. It also resets colors back to normal before as a last step.
Image may be NSFW.
Clik here to view.
by David Winterbottom (codeinthehole.com)