LinuxCommandLibrary

rolldice

Generate random dice roll results

TLDR

Roll a single 20 sided dice

$ rolldice d[20]
copy

Roll two six sided dice and drop the lowest roll
$ rolldice [2]d[6]s[1]
copy

Roll two 20 sided dice and add a modifier value
$ rolldice [2]d[20][+5]
copy

Roll a 20 sided dice two times
$ rolldice [2]xd[20]
copy

SYNOPSIS

rolldice [number_of_dice[d|D]number_of_sides]... [-qrsv]

PARAMETERS

number_of_dice[d|D]number_of_sides
    Specifies the dice to roll. For example, '2d6' means two 6-sided dice, 'd20' means one 20-sided die. If no argument is given, it defaults to '1d6'.

-r
    Redraws the dice on a terminal that supports cursor addressing, often using curses libraries.

-s
    Suppresses the ASCII art display of the dice. Only the numeric total of the roll(s) is shown.

-v
    Displays the version number of the rolldice utility and exits.

-q
    Operates in quiet mode, suppressing the initial 'Rolldice' message and other verbose output.

DESCRIPTION

The rolldice command is a classic Unix utility designed to simulate the rolling of one or more dice. It is often part of the bsdgames package, providing a simple yet engaging way to get random dice outcomes directly from the terminal. By default, rolldice rolls a single six-sided die and displays the result visually using ASCII art, making it easy to discern the outcome at a glance. Users can specify different combinations of dice, such as rolling multiple dice with a custom number of sides (e.g., 2d6 for two six-sided dice or 1d20 for a single twenty-sided die). The command supports various options to control output, like suppressing the graphical display in favor of a numeric total or redrawing dice on capable terminals, making it versatile for both casual use and scripting.

CAVEATS

The ASCII art display may not render correctly on all terminals, especially those that do not support certain characters or cursor positioning. The '-r' option's functionality depends on curses or similar terminal capabilities being present and correctly configured. The output of the command is based on pseudo-random number generation, which is sufficient for typical casual use but not for cryptographic purposes.

DEFAULT BEHAVIOR

If no arguments are provided, rolldice defaults to rolling a single 6-sided die (equivalent to '1d6').

MULTIPLE ROLLS

You can specify multiple dice rolls in a single command, e.g., 'rolldice 2d6 d20' will roll two 6-sided dice and one 20-sided die, showing results for each combination.

HISTORY

rolldice is a venerable part of the bsdgames collection, a suite of classic games and fun utilities that originated on BSD Unix systems. Its development dates back decades, making it one of the earliest command-line entertainment tools. Over time, as Unix-like operating systems evolved, bsdgames, including rolldice, were ported to various platforms, notably Linux. It remains a popular, light-hearted utility, showcasing the simplicity and utility of command-line tools for recreational purposes.

SEE ALSO

fortune(6), banner(6), cowsay(6)

Copied to clipboard