seq - macOS


seq generates a sequence of numbers that can be used as input for various commands or scripts.




  • -e, --end: Specify the end of the sequence.
  • -f, --format: Specify the format string for each number.
  • -i, --increment: Specify the increment between numbers.
  • -s, --separator: Specify the separator between numbers.
  • -w, --width: Specify the minimum width of each number.
  • -z, --zero-pad: Pad numbers with zeros to reach the specified width.


Create a sequence from 1 to 10:

seq 1 10

Create a sequence from 1 to 10, incrementing by 2:

seq -i 2 1 10

Create a sequence from 1 to 10, using a comma as the separator:

seq -s, 1 1 10

Create a sequence with a minimum width of 3 characters, zero-padded:

seq -w 3 -z 1 1 10

Common Issues

Error message: illegal value

This error occurs when the specified increment or end value is not a valid number. Ensure that the provided values are valid numeric characters.


seq can be used in conjunction with other commands:

Generate numbers for use in a loop:

for i in $(seq 1 1 10); do
    echo $i
  • bc: Perform arbitrary-precision arithmetic operations.
  • echo: Display a line of text.
  • xargs: Execute a command for each line of input.