Hacker News new | ask | show | jobs
by madethemcry 1149 days ago
Well, the simple explanation is probably that the author isn't aware of `lsof` and might even learn something from your comment.

lsof isn't something you automatically pickup if it's not your daily business (like so many other things). I for myself often forget about it but I have some usual ports to kill. So these days I simply search my shell history by port to find lsof again.

4 comments

I keep finding uses for more of the ls family: knew lsusb and lspci for ages, lsof is handy, and most recently I learned lsblk which is always worth using before dd'ing an image onto a disk, etc.

Back in the DOS era, there were few enough files on the system that I could just explore around and learn what everything did. That's no longer practical, but what's the alternative? There doesn't seem to be a "top 100 commands to get familiar with", or whatever. The ss64.com pages are pretty great, but...

ls /usr/bin

Choose a random entry you don't recognise and open the man page for it. There's not that many on most systems - I mean, there's likely a couple hundred or more, but some are convenience symlinks and many you'll already know.

For things you may not have by default, there's a few "awesome" lists available, like https://github.com/agarrharr/awesome-cli-apps

Hmm, tried that but that directory seems to contain ~3000 files on my old Ubuntu.
1621 on Pop, which is still about 15x more than I can reasonably remember. Hence the whole problem, it's not digestable unless you make digesting it your whole hobby. Ah well. Thanks for confirming, I guess.
I've known about LSOF and about kill but I've never put them together like this. I find his tool compelling simply because now I don't have to remember all this stuff.

What we really need is a tool like this for Windows. Find the process that keeps this file open and kill it. It's so annoying when I can't delete a file because some process has it open but I can't tell which one.

`handle` from sysinternals gets you some of the way there. Maybe all of the way there? (I haven't used Windows in over a decade)

https://learn.microsoft.com/en-us/sysinternals/downloads/han...

Powertoys for Windows has added a "What is blocking this file?" feature recently.

https://learn.microsoft.com/en-us/windows/powertoys/file-loc...

Useful, but talk about too little too late! The fact that this is an external tool, not part of the operating system, and that you are expected to, in 2023, blindly guess which application is holding your flash drive or documents open is pretty pathetic.
> What we really need is a tool like this for Windows.

Nevermind Windows, I want an app like this for android.

True, but there's no shortage of Stack Overflow answers: https://www.google.com/search?hl=en&q=kill%20process%20on%20...
> lsof isn't something you automatically pickup if it's not your daily business

Its a good thing now we have chatGpt to help us :)