How to print a range of IP addresses with Linux seq command

Use a format:

$ seq -f "10.20.30.%g" 40 50
10.20.30.40
10.20.30.41
10.20.30.42
10.20.30.43
10.20.30.44
10.20.30.45
10.20.30.46
10.20.30.47
10.20.30.48
10.20.30.49
10.20.30.50

Unfortunately this is non-obvious as GNU doesn't like to write man pages.


There is the prips utility which generates an IP list from a range or CIDR. Useful for work with large ranges:

$ prips 10.0.0.20 10.0.0.23
10.0.0.20
10.0.0.21
10.0.0.22
10.0.0.23

$ prips 10.0.0.0/23
10.0.0.0
10.0.0.1
10.0.0.2
<...>
10.0.1.254
10.0.1.255

You can use sed command with seq to print range of IP address.

seq 2 23 | sed 's/^/10.0.0./'

OR using echo and tr

echo 10.0.0.{2..23} | tr ' ' '\n'