Use seq to add range of numers in a loop

In bash use the seq command to add a range of numbers in a loop.

for i in `seq 10 20`; do telnet $i;done

Note back ticks around the seq command and arguments.

This particular example could be used as a simple  port scanner.

Back to GNU/Linux Command Line Tips