Missing /etc/hosts file â How can I create a new hosts file? [duplicate]

Clash Royale CLAN TAG#URR8PPP up vote
0
down vote
favorite
This question already has an answer here:
How can I restore configuration files?
7 answers
I have googled and searched Ask Ubuntu on this, but got no relevant answers.
I have no hosts file in /etc, I cannot find a hosts file in search, I am talking about the system hosts file not lampp/etc. I mention that because there is no hosts file there either - maybe that is a clue.
I want to know how to create a hosts file in Ubuntu or obtain a sample file I could copy and paste or I am happy to use the terminal if someone can help with best way to create the file and edit it.
I am not even sure what extension it should have - basically I just want the default hosts file that I understand Ubuntu should come with in my /etc folder.
command-line filesystem hosts
marked as duplicate by muru
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
Feb 18 at 11:36
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |Â
up vote
0
down vote
favorite
This question already has an answer here:
How can I restore configuration files?
7 answers
I have googled and searched Ask Ubuntu on this, but got no relevant answers.
I have no hosts file in /etc, I cannot find a hosts file in search, I am talking about the system hosts file not lampp/etc. I mention that because there is no hosts file there either - maybe that is a clue.
I want to know how to create a hosts file in Ubuntu or obtain a sample file I could copy and paste or I am happy to use the terminal if someone can help with best way to create the file and edit it.
I am not even sure what extension it should have - basically I just want the default hosts file that I understand Ubuntu should come with in my /etc folder.
command-line filesystem hosts
marked as duplicate by muru
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
Feb 18 at 11:36
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
The default contents are created by thenetbasepackage. See/var/lib/dpkg/info/netbase.postinst.
â muru
Feb 18 at 11:37
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
This question already has an answer here:
How can I restore configuration files?
7 answers
I have googled and searched Ask Ubuntu on this, but got no relevant answers.
I have no hosts file in /etc, I cannot find a hosts file in search, I am talking about the system hosts file not lampp/etc. I mention that because there is no hosts file there either - maybe that is a clue.
I want to know how to create a hosts file in Ubuntu or obtain a sample file I could copy and paste or I am happy to use the terminal if someone can help with best way to create the file and edit it.
I am not even sure what extension it should have - basically I just want the default hosts file that I understand Ubuntu should come with in my /etc folder.
command-line filesystem hosts
This question already has an answer here:
How can I restore configuration files?
7 answers
I have googled and searched Ask Ubuntu on this, but got no relevant answers.
I have no hosts file in /etc, I cannot find a hosts file in search, I am talking about the system hosts file not lampp/etc. I mention that because there is no hosts file there either - maybe that is a clue.
I want to know how to create a hosts file in Ubuntu or obtain a sample file I could copy and paste or I am happy to use the terminal if someone can help with best way to create the file and edit it.
I am not even sure what extension it should have - basically I just want the default hosts file that I understand Ubuntu should come with in my /etc folder.
This question already has an answer here:
How can I restore configuration files?
7 answers
command-line filesystem hosts
command-line filesystem hosts
edited Feb 18 at 11:32
muru
130k19275470
130k19275470
asked Feb 18 at 7:02
kerry
164418
164418
marked as duplicate by muru
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
Feb 18 at 11:36
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by muru
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
Feb 18 at 11:36
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
The default contents are created by thenetbasepackage. See/var/lib/dpkg/info/netbase.postinst.
â muru
Feb 18 at 11:37
add a comment |Â
The default contents are created by thenetbasepackage. See/var/lib/dpkg/info/netbase.postinst.
â muru
Feb 18 at 11:37
The default contents are created by the
netbase package. See /var/lib/dpkg/info/netbase.postinst.â muru
Feb 18 at 11:37
The default contents are created by the
netbase package. See /var/lib/dpkg/info/netbase.postinst.â muru
Feb 18 at 11:37
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
3
down vote
accepted
Lines in the /etc/hosts file have the following format:
<IP> <HOSTNAME>.<DOMAIN> <ALIAS>
You can create and/or edit the file with your preferred editor:
sudo nano /etc/hosts # with nano in a terminal
gksudo gedit /etc/hosts # with gedit
kdesudo kate /etc/hosts # with kate
Here are some useful lines for the file â lines beginning with # are comments and get ignored, empty lines are allowed:
# The following line is desirable for IPv4 capable hosts
127.0.0.1 localhost
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
You can read more about the format and get examples on the manpage (How can I get help on terminal commands?):
man hosts
There's also a Howto on ubuntuforums.org.
Further reading:
- What is the use of /etc/hosts?
- What are the default settings for 'etc/hosts' and 'etc/hostname'?
- How should I add a host name to /etc/hosts?
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
accepted
Lines in the /etc/hosts file have the following format:
<IP> <HOSTNAME>.<DOMAIN> <ALIAS>
You can create and/or edit the file with your preferred editor:
sudo nano /etc/hosts # with nano in a terminal
gksudo gedit /etc/hosts # with gedit
kdesudo kate /etc/hosts # with kate
Here are some useful lines for the file â lines beginning with # are comments and get ignored, empty lines are allowed:
# The following line is desirable for IPv4 capable hosts
127.0.0.1 localhost
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
You can read more about the format and get examples on the manpage (How can I get help on terminal commands?):
man hosts
There's also a Howto on ubuntuforums.org.
Further reading:
- What is the use of /etc/hosts?
- What are the default settings for 'etc/hosts' and 'etc/hostname'?
- How should I add a host name to /etc/hosts?
add a comment |Â
up vote
3
down vote
accepted
Lines in the /etc/hosts file have the following format:
<IP> <HOSTNAME>.<DOMAIN> <ALIAS>
You can create and/or edit the file with your preferred editor:
sudo nano /etc/hosts # with nano in a terminal
gksudo gedit /etc/hosts # with gedit
kdesudo kate /etc/hosts # with kate
Here are some useful lines for the file â lines beginning with # are comments and get ignored, empty lines are allowed:
# The following line is desirable for IPv4 capable hosts
127.0.0.1 localhost
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
You can read more about the format and get examples on the manpage (How can I get help on terminal commands?):
man hosts
There's also a Howto on ubuntuforums.org.
Further reading:
- What is the use of /etc/hosts?
- What are the default settings for 'etc/hosts' and 'etc/hostname'?
- How should I add a host name to /etc/hosts?
add a comment |Â
up vote
3
down vote
accepted
up vote
3
down vote
accepted
Lines in the /etc/hosts file have the following format:
<IP> <HOSTNAME>.<DOMAIN> <ALIAS>
You can create and/or edit the file with your preferred editor:
sudo nano /etc/hosts # with nano in a terminal
gksudo gedit /etc/hosts # with gedit
kdesudo kate /etc/hosts # with kate
Here are some useful lines for the file â lines beginning with # are comments and get ignored, empty lines are allowed:
# The following line is desirable for IPv4 capable hosts
127.0.0.1 localhost
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
You can read more about the format and get examples on the manpage (How can I get help on terminal commands?):
man hosts
There's also a Howto on ubuntuforums.org.
Further reading:
- What is the use of /etc/hosts?
- What are the default settings for 'etc/hosts' and 'etc/hostname'?
- How should I add a host name to /etc/hosts?
Lines in the /etc/hosts file have the following format:
<IP> <HOSTNAME>.<DOMAIN> <ALIAS>
You can create and/or edit the file with your preferred editor:
sudo nano /etc/hosts # with nano in a terminal
gksudo gedit /etc/hosts # with gedit
kdesudo kate /etc/hosts # with kate
Here are some useful lines for the file â lines beginning with # are comments and get ignored, empty lines are allowed:
# The following line is desirable for IPv4 capable hosts
127.0.0.1 localhost
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
You can read more about the format and get examples on the manpage (How can I get help on terminal commands?):
man hosts
There's also a Howto on ubuntuforums.org.
Further reading:
- What is the use of /etc/hosts?
- What are the default settings for 'etc/hosts' and 'etc/hostname'?
- How should I add a host name to /etc/hosts?
edited Feb 18 at 16:12
pa4080
12.3k52357
12.3k52357
answered Feb 18 at 8:49
dessert
20k55795
20k55795
add a comment |Â
add a comment |Â
The default contents are created by the
netbasepackage. See/var/lib/dpkg/info/netbase.postinst.â muru
Feb 18 at 11:37