Activity
Mon
Wed
Fri
Sun
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
Jan
Feb
Mar
What is this?
Less
More

Memberships

Linux Infrastructure Academy

139 members โ€ข Free

Home Lab Explorers

1.3k members โ€ข Free

Free Linux Course

2k members โ€ข Free

[Archived] KubeCraft (Free)

11.3k members โ€ข Free

AI Automation Agency Hub

299.8k members โ€ข Free

Creator Freedom (Free)

174 members โ€ข Free

1 contribution to Linux Infrastructure Academy
โš™๏ธ Linux Tip of the Day: The Hosts File
The /etc/hosts file is a fundamental system file that plays a key role in how your Linux machine resolves domain names to IP addresses. It's essentially a local, manually managed DNS table. When you type a hostname like www.google.com into your browser, your system first checks /etc/hosts to see if there's a corresponding IP address listed there before sending a query to an external DNS server. This local check makes resolution extremely fast since no network communication is required. ๐ŸŽฏ Primary Uses * Blocking Websites: This is a common use for parents or system administrators. By mapping a domain to your local machine's loopback address (127.0.0.1), you can effectively prevent access to a site. For example, adding 127.0.0.1 twitter.com will block access to Twitter on your machine. * Local Development: Developers use the hosts file to test web applications before they go live on a public server. By adding an entry like 192.168.1.10 myapp.local, they can access their development server using a user-friendly hostname instead of an IP address. This mimics a live environment. * Network Shortcuts: You can create simple, memorable hostnames for devices on your local network. Instead of remembering 192.168.1.50 for your network printer, you could add 192.168.1.50 printer to your hosts file and simply type printer into your browser or command line to access it. โœ๏ธ Editing the File The /etc/hosts file requires root permissions to edit. You can use a text editor like nano or vim with the sudo command. A good practice is to always back up the original file before making any changes. * Backup: sudo cp /etc/hosts /etc/hosts.bak * Edit: sudo nano /etc/hosts * Add your entries: Add new lines with the format IP_address hostname. * Save and Exit: Press Ctrl+O to save and Ctrl+X to exit in nano. After editing and saving, the changes take effect immediately without needing to restart any services. ๐Ÿ›ก๏ธ Important Notes * Comments: Lines starting with a # are ignored by the system and can be used to add comments for clarity. For example, # Blocked for security.
0 likes โ€ข 13d
@Jonathan Ingram yes, I think when we work in an internal enterprise network host files are pretty important.
1-1 of 1
Pushpendra Bairwa
1
5points to level up
@pushpendra-bairwa-5536
I am Server Administrator wants to transform my career into DevOps and enthusiastic about cloud and Linux.

Active 21h ago
Joined Feb 22, 2026