Created
June 6, 2019 11:01
-
-
Save aceakash/8a9bf2afa9e72133e0924690c914a101 to your computer and use it in GitHub Desktop.
echo hosts files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs') | |
console.log('========= About to read /etc/hosts') | |
const buf = fs.readFile('/etc/hosts', (err, buf) => { | |
if (err) { | |
console.error('Error reading hosts file', err) | |
return | |
} | |
console.log('========= HOSTS FILE (start)') | |
console.log(buf.toString('utf-8')) | |
console.log('========= HOSTS FILE (end)') | |
const buf2 = fs.readFile('/etc/hostname', (err2, buf2) => { | |
if (err2) { | |
console.error('Error reading hostname hosts file', err2) | |
return | |
} | |
console.log('========= hostname HOSTS FILE (start)') | |
console.log(buf2.toString('utf-8')) | |
console.log('========= hostname HOSTS FILE (end)') | |
const buf3 = fs.readFile('/etc/resolv.conf', (err3, buf3) => { | |
if (err3) { | |
console.error('Error reading resolv.conf hosts file', err3) | |
return | |
} | |
console.log('========= resolv.conf HOSTS FILE (start)') | |
console.log(buf3.toString('utf-8')) | |
console.log('========= resolv.conf HOSTS FILE (end)') | |
}) | |
}) | |
}) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment