🕵️ SicherheitslückenDetection and response for the actively exploited ProxyShell vulnerabilities(02.06.2022 um 02:00 Uhr)
⚠️ Malware / Trojaner / VirenHunting In Memory(21.06.2022 um 02:00 Uhr)
🔧 AI Nachrichten Getting the Most Out of Transformers in Elastic(23.08.2022 um 02:00 Uhr)
🕵️ SicherheitslückenDetecting and responding to Dirty Pipe with Elastic(09.09.2022 um 02:00 Uhr)
🕵️ SicherheitslückenDetection rules for SIGRed vulnerability(22.11.2022 um 01:00 Uhr)
🕵️ SicherheitslückenDetecting Exploitation of CVE-2021-44228 (Log4j2) with Elastic Security(22.11.2022 um 01:00 Uhr)
🕵️ SicherheitslückenElastic's response to the Spring4Shell vulnerability (CVE-2022-22965)(22.11.2022 um 01:00 Uhr)
🕵️ SicherheitslückenAnalysis of Log4Shell vulnerability & CVE-2021-45046(30.11.2022 um 01:00 Uhr)
⚠️ Malware / Trojaner / VirenEMOTET Dynamic Configuration Extraction(01.12.2022 um 01:00 Uhr)
⚠️ Malware / Trojaner / VirenQBOT Configuration Extractor(06.12.2022 um 01:00 Uhr)
🕵️ SicherheitslückenDetection and response for the actively exploited ProxyShell vulnerabilities(02.06.2022 um 02:00 Uhr)
⚠️ Malware / Trojaner / VirenHunting In Memory(21.06.2022 um 02:00 Uhr)
🔧 AI Nachrichten Getting the Most Out of Transformers in Elastic(23.08.2022 um 02:00 Uhr)
🕵️ SicherheitslückenDetecting and responding to Dirty Pipe with Elastic(09.09.2022 um 02:00 Uhr)
🕵️ SicherheitslückenDetection rules for SIGRed vulnerability(22.11.2022 um 01:00 Uhr)
🕵️ SicherheitslückenDetecting Exploitation of CVE-2021-44228 (Log4j2) with Elastic Security(22.11.2022 um 01:00 Uhr)
🕵️ SicherheitslückenElastic's response to the Spring4Shell vulnerability (CVE-2022-22965)(22.11.2022 um 01:00 Uhr)
🕵️ SicherheitslückenAnalysis of Log4Shell vulnerability & CVE-2021-45046(30.11.2022 um 01:00 Uhr)
⚠️ Malware / Trojaner / VirenEMOTET Dynamic Configuration Extraction(01.12.2022 um 01:00 Uhr)
⚠️ Malware / Trojaner / VirenQBOT Configuration Extractor(06.12.2022 um 01:00 Uhr)

🔧 Programmierung 🕛 kürzlich 3 Min Lesezeit
0

Stop Wasting Tabs: How to background your dev servers and kill them with one command

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht

If you are building full-stack apps (like a Django backend mated to a React/Vite frontend), you know the struggle of the "Locked Terminal."



You run npm run dev or python manage.py runserver, and suddenly that terminal pane is completely hijacked. To run another command, you're forced to open a brand-new tab, split your screen, or context-switch out of your flow.



Worse yet, when you hit Ctrl+C to close those servers, they sometimes leave behind "zombie processes" that stubbornly hold onto your ports (8000 or 5173), forcing you to hunt down PIDs just to restart your environment.



On my Linux setup, I got tired of managing a million tabs. Here is how to run your servers cleanly in the background and terminate them instantly using a single custom Zsh function.






The Trick: The Power of the Ampersand (&)



Most developers run their servers in the foreground. But if you append a simple & to your startup command, Linux pushes that process into the background, giving you your terminal prompt back immediately.



Instead of this:




CODE
npm run dev
# ...terminal is now locked...






Do this:




CODE
npm run dev &






What happens next? Your server spins up, its logs will still print gracefully to your screen so you can track errors, but your terminal prompt stays active. You can keep typing commands in the exact same window!






The Problem: How do you kill a background server?



Because the server is running in the background, hitting Ctrl+C won't stop it anymore. If you want to free up ports 5173 (Vite) and 8000 (Django) for your next session, you need a surgical cleanup tool.



Let’s automate this by adding a helper function to your shell configuration.






Step 1: Add the Automation to your ~/.zshrc



Open your shell config file (vim ~/.zshrc) and paste this custom function at the bottom:




CODE
# Stop background development servers and instantly free ports
stop-dev() {
echo "🛑 Shutting down development stack..."

# 1. Forcefully kill any process holding onto our frontend/backend ports
sudo fuser -k 5173/tcp 8000/tcp 2>/dev/null

# 2. Verify the ports are completely clear
echo "🔍 Verifying port status..."
if ! lsof -i :8000 -i :5173 > /dev/null; then
echo "✅ Ports 8000 and 5173 are completely clear and ready!"
else
echo "⚠️ Warning: Some processes are still lingering."
fi
}






Save and close the file, then reload your shell environment:




CODE
source ~/.zshrc









The workflow



Now your development loop becomes incredibly smooth and single-tab friendly:





  1. Start your stack:




CODE
npm run dev & python manage.py runserver &






(Both servers are now running concurrently in the background of a single window!)





  1. Keep working: Use that same terminal prompt to run Git commands, create migrations, or check logs.


  2. Nuke it when done: When you're ready to wrap up your session, simply type:




CODE
stop-dev






You'll prompt for sudo password once if your cache is expired, and fuser will cleanly clear both ports out of memory instantly.



How do you manage your local full-stack setups? Let me know in the comments below!

Vollständiger Original-Bericht
Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 53%
🟡 In Evaluierung 26%
🟢 Keine Auswirkung 16%
Spannende Innovation 5%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
2 Quellen
Detecting and responding to Dirty Pipe with Elastic
1 Quelle
Detection and response for the actively exploited ProxyShell vulnerabilities
1 Quelle
Hunting In Memory
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Stop Wasting Tabs: How to background your dev servers and kill them with one command

Thematisch verwandte Begriffe: Stop, Wasting, Tabs, background · 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 ...