LinuxCommandLibrary

jot

Print sequential or random data

SYNOPSIS

jot [-cnr] [-bword] [-pprecision] [-sstring] [-wword] count [step] [start]

PARAMETERS

-bword
    Print specified word exactly count times

-c
    Use C locale for numeric output (no localization)

-n
    Suppress trailing newline at end of output

-pprecision
    Set decimal precision for floating-point numbers

-r
    Output random numbers instead of sequential

-sstring
    Separate sequence values with string (default: newline)

-wword
    Use word as printf-style format string

DESCRIPTION

jot is a command-line utility for producing sequences of numbers, text strings, or random values, ideal for scripting, test data generation, or piping into other tools. Originating from BSD Unix, it offers flexibility beyond simple counting.

Without options, jot count outputs lines from 1 to count. Specify start and step for custom arithmetic progressions, like jot 5 0 0.5 for 0, 0.5, 1, 1.5, 2. Options enable repeating words, random numbers, custom separators, precision control, and printf-style formatting.

For instance, jot -b foo 3 prints 'foo' thrice; jot -r 10 1 100 yields random integers from 1-100. On Linux, it's not standard (use seq alternative) but available via BSD utils packages. Compact and powerful for shell automation.

CAVEATS

Not installed by default on most Linux distros; install via bsdmainutils or athena-jot. Lacks some seq(1) features like --format.

COMMON EXAMPLES

jot 10
1
2
...10

jot -s, 3 0 10
0,5,10

jot -w '%05d' -r 5 0 99999
Random 5-digit numbers

HISTORY

Introduced in 4.4BSD (1995); standard on FreeBSD/macOS. Predates GNU seq(1), providing similar range generation with extras like repetition/randomization.

SEE ALSO

seq(1), yes(1), shuf(1)

Copied to clipboard