Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Sichere ProgrammierungMy "real reading" metric has only ever been fired by bots(20.09.2026 um 09:09 Uhr)
Sichere ProgrammierungPipes and Flow - CI/CD Pipeline An Overview(20.09.2026 um 09:17 Uhr)
Sichere ProgrammierungI Built a Spring Boot Starter to Handle Duplicate API Requests(20.09.2026 um 09:24 Uhr)
Sichere ProgrammierungSAM 3 found the cars. Jev decided what they were worth.(20.09.2026 um 09:45 Uhr)
Linux Tipps & HardeningVanilla is dead it is far past time to admit it.(20.09.2026 um 09:43 Uhr)
IT Security VideoGIGA: Braucht man den Flugmodus eigentlich heute noch?(20.09.2026 um 09:30 Uhr)
Sichere ProgrammierungMy "real reading" metric has only ever been fired by bots(20.09.2026 um 09:09 Uhr)
Sichere ProgrammierungPipes and Flow - CI/CD Pipeline An Overview(20.09.2026 um 09:17 Uhr)
Sichere ProgrammierungI Built a Spring Boot Starter to Handle Duplicate API Requests(20.09.2026 um 09:24 Uhr)
Sichere ProgrammierungSAM 3 found the cars. Jev decided what they were worth.(20.09.2026 um 09:45 Uhr)
Linux Tipps & HardeningVanilla is dead it is far past time to admit it.(20.09.2026 um 09:43 Uhr)
IT Security VideoGIGA: Braucht man den Flugmodus eigentlich heute noch?(20.09.2026 um 09:30 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

Where is the hosts file on Mac, Windows, and Linux?

You need to open the hosts file. You already know why. You just cannot remember the path.

Here it is for each OS, plus how to open it without fighting permissions.

Paths

OS Path
macOS /etc/hosts
Linux /etc/hosts
Windows C:\Windows\System32\drivers\etc\hosts

On Unix systems /etc/hosts is often a symlink into the real file. Edit the path above. Do not hunt for a second copy in your home folder.

Open it on macOS

Terminal:

sudo nano /etc/hosts

Or open it in your editor with elevated rights:

sudo code /etc/hosts
# or
sudo vim /etc/hosts

Save, then flush DNS:

sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

Finder will not let you edit /etc casually. Use the terminal or an editor launched with sudo.

Open it on Windows

  1. Open Notepad as Administrator
  2. File → Open
  3. Go to C:\Windows\System32\drivers\etc\
  4. Change the file type filter to All Files
  5. Open hosts

Without admin rights Windows will open the file but refuse to save.

Then flush DNS:

ipconfig /flushdns

Open it on Linux

sudo nano /etc/hosts
# or
sudo vim /etc/hosts

Flush depends on the stack. Common options:

sudo resolvectl flush-caches
# or
sudo systemd-resolve --flush-caches

What a normal line looks like

127.0.0.1   localhost
127.0.0.1   myapp.test
# 203.0.113.10  staging.example.com

Rules that save time:

  • IP first, hostname second
  • Spaces or tabs both work
  • # comments out the rest of the line
  • One hostname per line is easier to read than a long list

Quick check after editing

# macOS / Linux
ping -c 1 myapp.test
# or
getent hosts myapp.test

Windows:

ping myapp.test

If the IP in the reply is wrong, the hosts line did not apply yet. Flush DNS and try again before changing the app.

Common mistakes

  • Editing a copy in Downloads instead of the system file
  • Saving without admin rights (Windows especially)
  • Leaving a # in front of the line you meant to enable
  • Forgetting the DNS flush
  • Using a real public TLD like .com for local names when .test would avoid surprises

Bookmark the path for your OS. You will need it again.

If you switch hosts a lot, a small desktop manager helps keep profiles and DNS flush in one place: Locahl.

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Where is the hosts file on Mac, Windows, and Linux?

Thematisch verwandte Begriffe: Where, hosts, file, Windows · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-93956 | A flaw has been found in olivier-ls PHP-FTS up to 1.1.2. Affected by thi…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick