Text and processing

The seq command

Generates a sequence of numbers. Perfect for loops, tests and generating data.

Syntax

seq [inicio [paso]] fin

Most useful options

-s SEPSeparator between numbers (newline by default)
-wPads with zeros to equal width

Copy-ready examples

$ seq 1 5From 1 to 5
$ seq 1 2 9Step two
$ seq -w 8 11With leading zeros

You can try them in the browser terminal: it does not touch your computer.

Typical mistakes

  • seq is not a loop: it only prints numbers. To repeat a command use a for or xargs.

Related commands

FAQ

Can I generate decimals?

Yes: seq 0 0.5 2 produces 0, 0.5, 1, 1.5 and 2.

Learn to actually use it

The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.

Start the free course