Korean

seq — Generate number sequences

Linux / Basic Linux commands / seq.html

Basic Linux commandsOriginalRegistered 2026-10-20T09:00:00+09:00

Prints a sequence of numbers within a range at a given step.

Basic Information

Command Nameseq
One-line IntroductionPrints a sequence of numbers within a range at a given step.
Provided byGNU coreutils
Official Documentationhttps://man7.org/linux/man-pages/man1/seq.1.html
Supported Operating SystemsLinux, macOS, BSD, WSL
Installation StatusInstalled by default
CategoryLinux basic commands (tags: Linux basic commands (tags: seq, number, repeat, loop))

What is this command?

seq takes start, step and end values and prints numbers one per line. It is commonly used to build loop ranges or generate test data.

-w pads numbers to a fixed width and -f applies a printf format. Floating point is supported but precision caveats apply.

What problems does it solve?

  • Building loop ranges
  • Generating sequentially numbered file names
  • Creating numeric test data
  • Producing descending or stepped sequences

Key features

Basic sequence

Given start and end, it counts by one.

  • When to use: Creating a simple range
  • What you get: It plugs directly into loops.
  • Limitations: Large ranges produce huge output.

Custom step

The middle argument sets the increment.

  • When to use: Even numbers or steps of five
  • What you get: Produces exactly the desired sequence.
  • Limitations: Floating steps can accumulate rounding error.

Formatting

-w and -f control width and format.

  • When to use: Zero-padding file names
  • What you get: Names sort correctly.
  • Limitations: A malformed format string causes an error.

Installation and usage

Check whether it is installed

seq --version

sudo apt install coreutils # Debian/Ubuntu sudo dnf install coreutils # Fedora

Real-world examples

One to five

Print a basic sequence.

seq 1 5

Custom step

Count from 0 to 10 by two.

seq 0 2 10

Zero padding

Produce 01 through 05.

seq -w 1 5