Use the Linux seq command to generate a sequence of numbers (recommended)
Linux's seq command can generate a list of numbers at lightning speed, and it is easy to use and flexible.
One of the easiest ways to generate a list of numbers in Linux is to use the seq (Series sequence) command. In its simplest form, seq takes a numeric parameter and outputs a list from 1 to that number. For example:
$seq 5
one
two
three
four
five
Seq always starts with 1 unless otherwise specified. You can insert different numbers in front of the final number to start a sequence.
$seq 3 5
three
four
five
Specify increment
You can also specify incremental strides. Suppose you want to list multiples of 3. Specify the start point (the first 3 in this example), the increment (the second 3), and the end point (18).
$seq 3 3 18
three
six
nine
twelve
fifteen
eighteen
You can choose to use negative increments (that is, decrements) to change the number from large to small.
$seq 18-3 3
eighteen
fifteen
twelve
nine
six
three
The seq command is also very fast. You may be able to generate a list of a million numbers in 10 seconds.
$time seq 1000000123. 9999989999991000000real 0m9.290s