Seq Command in Linux: Linux seq command generates a list of numbers – you can use this in scripts and many other functions. Let’s see the examples.
Basic usage of command
Just typing seq 5 will create 5 numbers
[root@server ~]# seq 10
1
2
3
4
5
[root@server ~]#
If you type two numbers, first number will be start and other one will be end number.
[root@server ~]# seq 21 25
21
22
23
24
25
[root@server ~]#
You can add a third number in between which will work as a step.
for example, if you type seq 5 5 50 it will generate a number from 5 to 50 at the interval of 5 – see the example below
[root@server ~]# seq 5 5 50
5
10
15
20
25
30
35
40
45
50
[root@server ~]#
You can generate numbers in descending order as well by adding the middle number in -ve
[root@server ~]# seq 10 -1 1
10
9
8
7
6
5
4
3
2
1
Practical Usage of seq command
First, let’s see how to create files using the seq command. You will need to use format strings functions i.e. -f
[root@server seq]# touch $(seq -f "file-%g.txt" 1 10)
See the output of the command above.

You can use seq command in your scripting for example While Loops or For Loops.
We will see an example for loop.
[root@server seq]# for i in $(seq 1 10); do echo "Hello $i"; done
Hello 1
Hello 2
Hello 3
Hello 4
Hello 5
Hello 6
Hello 7
Hello 8
Hello 9
Hello 10
Here is Man page you can use it to learn something more about it which may be covered in this page.