Hacker News new | ask | show | jobs
by newprint 1142 days ago
After 3 decades working on Windows, I recently got into Linux and stared learning bash through "The Linux Command Line, 5th ed." book and watching youtube videos. Powershell is so much nicer and a lot more productive to work with compared to bash. Unlike the bash commands that returns strings, Powershell commands return objects. Working in any OOP language and Powershell feels very natural.
2 comments

Just to corroborate from the opposite direction, I have run exclusively Linux on my personal machines for nearly a decade, and I started a new job where I get to use PowerShell, and it's really amazing, the amount of grep/tail/head (or Get-ChildItem/Select -First/-Last) I have to do is so much less, it feels so much less klunky. Probably the only thing I don't like more so far is Get-Help, because it doesnt put you into a pager with search, it just dumps to text. EDIT: apparently I need Help not Get-Help for paging EDIT2: and I hate that PowerShell doesn't support readline/emacs keybindings
I thought the PSReadline module had some of that but then it might be a "nearly" compatible experience which can be really jarring when you hit the edge cases.
Maybe I just didn't have enabled, thanks for reminding me, seems good enough for me
What’s the dirs -v, pushd and popd equivalent in PS?
popd and pushd are aliases for Pop-Location and Push-Location, so they are the PowerShell equivalent. Unsure about dir -v.

dir itself is an alias for Get-ChildItem, but I don't know about -v (natural sort of version number)

dirs -v presents a numbered stack of directories. Pushd doesn’t just function on one directory but also takes in a number pointing to a directory on the stack. Nothing like this exists out of the box for PS and it’s one of the most productive features in Bash.
What do those do
Keep a stack of dirs where u can jump very quickly into.