31 comments

[ 2.8 ms ] story [ 51.4 ms ] thread
Not bad, but one big criticism, never do a 'kill -9' first, that will stop the program from cleaning up after itself if killed using -9.

Use one of these instead:

    -TERM   then wait, if not
    -INT    then wait, if not
    -HUP    then wait, if not
    -ABRT
If you are sure all of these fail, then use -9 (-KILL). But assume the program has a major bug and try and find another program that will do the same task and use that instead.
This is article is likely LLM generated and it regurgitates as first go what the last resort should be. After seeing that command I stopped reading.
Never use `kill -9`, instead refer to the signal directly. 9 is not always the same signal on all platforms.
HUP is usually sent to daemons to instruct them to reinitialize and reread their configuration files.

Is it still passed when a terminal is disconnected? I understand a dial-up modem was involved in the original intended use.

On a modern OS, doesn’t the kernel (eventually) take care of the cleanup anyways?
My most used windows command is, and will always be, `ls`.

Then I'm reminded that it's not a know file or directory.

Same! Closely followed by 'cat' lol. 'type' just doesn't register in my brain
On one our linux machine filesystem became strange, probably because somebody mistyped `ls /bin` as `ln /bin`. I think docs say hardlinking folders is impossible or maybe /bin was a symlink.
It's 2026, you should not be using command prompt (or batch.) In powershell ls is a built in alias to get-childitem and has been for years, and in recent versions of windows you'd have to go out of your way to get a command prompt (you would have to open a powershell terminal and then run cmd.)
ok, but how do i get the only linux command i know?

ctrl+r

findstr is an underappreciated command line tool. I use it a lot
> Author's note: From here on, the content is AI-generated

Kudos to the author for their honesty in admitting AI use, but this killed my interest in reading this. If you can use AI to generate this list, so can anyone. Why would I want to read AI slop?

HN already discourages AI-generated comments. I hope we can extend that to include a prohibition on all AI-generated content.

> Don't post generated comments or AI-edited comments. HN is for conversation between humans.

If I get that kind of content, my first reaction is to close it, it is kind of low effort content nowadays.

Unfortunely at work it isn't as easy with all the KPIs related to taking advantage of AI to "improve" our work.

I could've done better with research, but this post has been collecting dust in the drafts, so I decided to try my first (and last) time to finish the work I started a few months ago.
> Windows: netstat -n -a | findstr "https" (//note the double quotes)

netstat works perfectly fine on linux as well. If you're looking for https connections it's certainly far more efficient than 'lsof'.

also if you use '-n' then you're not going to get service names translated, so that probably should be:

netstat -n -a | find "443"

traceroute vs tracert always catches me out.
> Finding a specific file by name across the system

> Linux: find / -name "config.txt"

This is not how you find a file across the entire system, you use plocate for that. find would take ages to do what plocate does instantly

No. "Slower" is not the same as "different functionality".

In fact, "find" is guaranteed to be more correct. And more widely available.

Not having to run a mess of Linux commands to install software.
Can we do a satirical thread here please? I'm curious what HN can come up with :D

I'll start:

  Linux             : trash-empty 
  windows equivalent: format C:

  Linux             : sudo apt update && sudo apt upgrade
  Windows equivalent: shutdown /r
less or at least more?
which / where is the one that always trips me up.
> "Author's note: From here on, the content is AI-generated"

Ah, I see, googling the equivalent of "clear" was too much work and you had to get an LLM to do it for you. Well at least you were honest about it

ridiculous...

Why this entry is in the top 30?

Why would you use CMD when Powershell exists?
Can I just do a shout-out for UnxUtils [1]?

I've had it on every Windows computer I used at work since forever now, and it is extremely useful to be able to use things like `sed` and `gawk` (and even `make`) from the command prompt

[1] https://unxutils.sourceforge.net/

Let me present you my favorite, how do you figure out dirname, basename and filename in batch script?

    set filepath="C:\some path\having spaces.txt"

    for /F "delims=" %%i in (%filepath%) do set dirname="%%~dpi" 
    for /F "delims=" %%i in (%filepath%) do set filename="%%~nxi"
    for /F "delims=" %%i in (%filepath%) do set basename="%%~ni"

    echo %dirname%
    echo %filename%
    echo %basename%
It is just as intuitive as one would expect.