Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

include onto /etc/hosts

Status
Not open for further replies.

gatetec

MIS
Mar 22, 2007
420
US
I need to edit /etc/hosts file due to a long list for printers. I personally don’t touch /etc/hosts file often if possible. I am wondering if there is a way to “include” a file onto /etc/hosts so that I can just edit the file instead of /etc/hosts. In that case, I can simply edit the file as needed w/o touching /etc/hosts. Please let me know.

thx much
 
I never heard of including a file within the /etc/hosts!

why don't you make a copy of the /etc/hosts file first!

cp /etc/hosts /etc/hosts.old

and then edit the hosts.old and when you are sure that this is the final hosts file just rename it back!

mv /etc/hosts.old /etc/hosts

(you can take a copy of the old file as well before doing the above just as a precaution!)

Regards,
Khalid
 
Me neighter. I don't think that there is a way to include some other file into hosts config. Do like Khalid suggest - make backup of original /etc/hosts, change it and test. You can always come back.

Regards,
Blazej
 
Probably not an option, but you could always add the entries to your DNS servers. This would server the same function, but has a drawback... or two.
 
Yeah.. I think there is no way to do so.
Thank you for confirming that.

 
there is one more way without going into /etc/hosts file.

cp -p /etc/hosts /etc/hosts.07312007
cat /your_file_name >> /etc/hosts

This will add your file contents to /etc/host without opening it.
 
I know what you are trying to obtain , same as you can do with conf file of Apache, but unfortunately, this cant be done with the host file ...

rgds,

R.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top