Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

In PowerShell:

  gci -file | sort-object size | select name, size -first 4 | % { $_.size /= 1MB; $_ } | ConvertTo-Json


ConvertTo-Json? What kind of naming convention is that, especially with all the other commands being lowercase?


The naming convention is `verb-noun`. It's convenient for discoverability and consistency. The short commands are aliases.

The last command is properly cased, because I pressed tab (it auto-completes and fixes the case). The other commands I typed without tab completion. You can write however you want, PS is not case sensitive.


i dont think you need to select name and size, you can just remove it and use `select -first 4`, but cool, I never knew about `/=` syntax


I was trying to replicate the nushell example, which only has name and size in the output.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: