Forrest logo
tool overview
On this page you find all important commands for the CLI tool seq. If the command you are looking for is missing please ask our AI.

seq

seq is a command line tool available in Unix-like operating systems that generates a sequence of numbers. It is commonly used in scripting and automation tasks.

The basic syntax of the command is "seq [OPTION]... LAST", where LAST is the last number in the sequence.

If no options are provided, seq will generate a sequence of numbers starting from 1 to the LAST number. The numbers are printed to the standard output line by line.

seq also supports specifying a start number and increment value, allowing for more flexible sequences. By using the syntax "seq [OPTION]... FIRST INCREMENT LAST", you can control the starting point and the step size between numbers.

Some common options for seq include:

  • -s: Specifies the separator between numbers (default is a newline).
  • -w: Pads the output with leading zeros to have a consistent width.
  • -f: Allows a specific format for the output, by using printf-style formatting.
  • -r: Prints the sequence in reverse order, from LAST to the start number.

seq can be used in various ways, such as generating a series of filenames, controlling the loop iteration in scripts, producing numeric ranges for piping to other programs, and much more.

Overall, seq is a simple yet powerful command line tool that provides a convenient way to generate sequences of numbers in Unix-like environments.

List of commands for seq:

  • datamash:tldr:3ad5f datamash: Get max, min, mean and median of a single column of numbers.
    $ seq 3 | datamash max 1 min 1 mean 1 median 1
    try on your machine
    explain this command
  • seq:tldr:5cb7e seq: Sequence from 1 to 10.
    $ seq 10
    try on your machine
    explain this command
  • seq:tldr:bc8f9 seq: Every 3rd number from 5 to 20.
    $ seq 5 3 20
    try on your machine
    explain this command
  • seq:tldr:be82c seq: Separate the output with a space instead of a newline.
    $ seq -s " " 5 3 20
    try on your machine
    explain this command
  • seq:tldr:bea94 seq: Format output width to a minimum of 4 digits padding with zeros as necessary.
    $ seq -f "%04g" 5 3 20
    try on your machine
    explain this command
tool overview