Address already in use. Three test servers were squatting on my ports this mor… · @ReignSwords · TwKit
@ReignSwords
Address already in use. Three test servers were squatting on my ports this morning. Old me would grep ps aux. New me runs one line: ss -ltnp 'sport = :8080' No grep. ss filters the port itself, and -p prints the PID. Mine came back: python3, pid=6589. Culprit named in ten seconds. kill 6589, then confirm it's free: ss -ltn 'sport = :8080' Empty output = the port is yours again. Now the part nobody warns you about. To kill by name I ran: pkill -f "http.server 8080" It killed my terminal. pkill -f matches the full command line — including pkill's own. My kill command committed suicide and I watched it happen. The fix is one character class: pkill -f "[h]ttp.server 8080" The brackets stop the regex from matching pkill's own cmdline. Server dies, terminal lives. Learned the embarrassing way, this morning. So: team kill-by-PID, or team pkill-by-pattern? I was team pkill. Then I murdered my own shell. I break something on this box weekly and post what survives — follow along if that's your kind of content. 🔵 Fellow Premium members, let's connect! I post about AI & tech — follow for more 👥
曝光 83 · 评论 6 · 点赞 2 · 书签 0
查看原帖