6 ms·
The UX of "killport 8080" vs Googling the stack overflow on what you just typed every time is way better.
by nsxwolf 3y ago
The UX of "killport 8080" vs Googling the stack overflow on what you just typed every time is way better.
- OJFord 3y agoYou don't have to do it exactly like that or probably 'google the stack overflow' once you've used kill & lsof (whether for this purpose of something else). My thought as GP's as soon as I read the title was 'lsof & kill?' - I doubt they looked up the pretty simple command they gave. And as they said, 'which you can easily turn into an alias [well, a function]', which you could call 'killport' if you want for exactly the same functionality.
- recov 3y agofunction killport() { kill $(lsof -t -i:$1) }
- deleted 3y ago[deleted]
- bashinator 3y agoAs a sysadmin, `lsof` is part of my standard toolkit; I wouldn't be able to do my job if I had to look stuff like that up on Stackoverflow every time.
- deleted 3y ago[deleted]
- schnebbau 3y agoNice flex but what about every other person that is not a sysadmin?
- stametseater 3y agoThey don't find themselves in the situation of sitting before a terminal emulator needing to kill a process by port in the first place?
- greiskul 3y agoDevelopers find themselves in tnis situation sometimes and are not sysadmins. I had this situation before, and I would need to google to know what lsof does and how to use it. And so do many others that are commenting positively here.
- stametseater 3y agoExperienced users (developer or otherwise) of unixy systems already know what lsof is. Inexperienced developers only need to learn it once, then they join the ranks of the aforementioned. Using these sort of systems for any length of time in the capacity of a developer or even just a hobby enthusiast will effectively make you a 'sysadmin', at least w.r.t. knowing the basic standard tools. Not least because lsof is useful for many sort of tasks (like figuring out which program is using a drive you're trying to umount), so chances are high that people in these situations already know about lsof. And besides having to learn that lsof exists, you'd also have to learn that this even more obscure tool exists. And what happens if you prefer for the program to terminate itself gracefully, cleaning up whatever mess it might have made, instead of sending SIGKILL? Now you have to look up the PID or program name anyway, probably using lsof..
- htfu 3y agoGet TLDR, the examples it gives almost always save me from man or google. So handy!
- bashinator 3y ago
- avgcorrection 3y agoMeanwhile other people are developers who only occassionally need to do this kind of thing. So they/we forget.
- renewiltord 3y agoThis is the sort of thing which Copilot on the command line is great at, actually. Copilot X is decent, too, but I prefer `copilot.vim` in my neovim plus `EDITOR=nvim` plus C-x C-e "# kill all processes listening on port 2134" which then proceeds to put it into your history and with a comment explaining it and keywording it so you can find it easier.
- pxc 3y ago> Googling the stack overflow [...] every time Don't look basic Unix stuff up on the web. Look it up in your Unix environment. The documentation is self-contained, and accessing it internally is way, way more efficient. So instead, try one of these: - use `man lsof`, search 'EXAMPLES' to jump down to the examples section, and search for the word 'port' - search directly though examples: `tldr lsof | grep -A2 -i port` - look through your shell history with grep or CTRL+R - type the first few letters of the command and let history-based autocompletion hint the rest to you Those options may seem strange if you're not used to them. But if you're not using techniques like that, and instead going to your web browser to look up CLI usage, you don't need to learn the CLI— you need to learn how to learn the CLI. Once you do that, a ton of things will become much easier and quicker for you to deal with.