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

Memberships

Cyberseb

106 members • Free

Linux Infrastructure Academy

220 members • Free

Dev Mentor Dave

17 members • Free

Mandarin Blueprint

34.5k members • Free

Prometheus Code

102 members • Free

2 contributions 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 • 2d
@Michael Sanderson Sorry if I'm slow to reply. I'm learning so tend to look for manuals or docs to help me understand new things. This is the file.
0 likes • 2d
I remember seeing something about DNS and HTTP in firefox settings when I first switched to linux but didn't understand it, so left it on default. DNS over HTTPS is active in 'Increased Protection' and 'Max Protection' with the default being Cloudflare in both. I'm not sure if this has anything to do with hosts.deny not being used, seems to be more about encryption? I tried each setting but was still able to access youtube. 'default resolvers' are mentioned in this link: https://support.mozilla.org/en-US/kb/dns-over-https?as=u&utm_source=inproduct I didn't know how to see what my default resolver was, so I asked ChatGPT for a hint. It suggested I look at /etc/resolv.conf When searching what the 'nameserver' IP was I found this post that mentions the order of things being listed in '/etc/nsswitch.conf' causing some kind of bypass. https://unix.stackexchange.com/questions/612416/why-does-etc-resolv-conf-point-at-127-0-0-53 TBH this is way beyond my current understanding 😂 I think my router might be resolving the DNS
DOCs intro, working to be great.
Hello everyone, I'm relatively new to Linux and want to move around the command line like a pro. I hope to master this here in this space. I have an LPI Linux Essentials certification, but I hope to achieve more in due time. Thanks for having me!!
0 likes • 2d
@Jordan Matthews Hi I'm also new to Linux 😀 Have you found any interesting commands in your search to master the command line? I like 'grep', means I dont have to open a file to find what I'm looking for 🥰
1-2 of 2
Mel Baker
1
5points to level up
@mel-baker-5591
In 2021 I started teaching myself programming. I'm a slow but consistent learner that takes an interest in a variety of areas.

Active 1d ago
Joined Jun 5, 2026