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 1try on your machineexplain this command
seq:tldr:5cb7e seq: Sequence from 1 to 10.$ seq 10try on your machineexplain this command
seq:tldr:bc8f9 seq: Every 3rd number from 5 to 20.$ seq 5 3 20try on your machineexplain this command
seq:tldr:be82c seq: Separate the output with a space instead of a newline.$ seq -s " " 5 3 20try on your machineexplain 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 20try on your machineexplain this command