msgbartop
A chronological documentation test project, nothing serious, really!
msgbarbottom

03 Jun 2008 Generate a /etc/hosts file from the command line

Posted by

This is a simple example of how you can populate a /etc/hosts file with 100 IPs and hosts from the command line

# N=1; for i in $(seq -w 100); do echo "192.168.99.$N host$i"; P=$(expr $P + 1); done >> /etc/hosts

The result file /etc/hosts

192.168.99.201 host001
192.168.99.201 host002
192.168.99.201 host003
192.168.99.201 host004
192.168.99.201 host005
192.168.99.201 host006
192.168.99.201 host007
192.168.99.201 host008
192.168.99.201 host009
192.168.99.201 host010
192.168.99.201 host011
192.168.99.201 host012
192.168.99.201 host013
192.168.99.201 host014
192.168.99.201 host015
192.168.99.201 host016
192.168.99.201 host017
192.168.99.201 host018
192.168.99.201 host019
192.168.99.201 host020
...

Tags:

Comments are closed.