Live data from Hacker News

A Saner Windows Command Line

futurice.com

41–50 of 164 posts

Re: A Saner Windows Command Line

#41
>> Let's be honest. What many people think of as "the default Windows command line", cmd.exe, is atrociously bad. Selection is awkward, resizing is hard, the syntax is arcane, the list goes on. If you do nothing else, there are two things you can do to make the basic, vanilla experience bearable.

Funny, from a guy coming from Windows to Unix I think the exact opposite. Each command comes with a bazillion options and the defaults are simply atrocious (to read the man, oy). Yes I understand that you can tailor each command in some startup script but why? It almost feels like every command needs to be created to solve 5 million things when 99% of the time you use it for 1 or 2 things. A few of my favorites:

Scripting:

A = 123 vs A= 123 vs A=123 should be the same!

Please use trim() in your program when parsing tokens!

Keyboard:

Please, for the love of god, make the keyboard behave like a keyboard. I don't want to be logged into some terminal and have the Backspace not behave like a backspace (^H??). Yes, I'm sure I can make it work via some, again, configuration magic or enter emacs mode, but, again, why?

cd.. should just work.

Having been on unix for the last 7mo after years of windows, I do like some things but let's not be too quick to call the kettle black.

Re: A Saner Windows Command Line

#42
post #20
post #8

Earlier quoted context omitted.

> The script was 11 lines long (vs 3 lines in Python), it was harder to read and understand. Note that this might be true for one script, and the opposite might be true for another script. Something is saner in bash, something is better in PS. They have fundamental differences (text- vs. object-based), and neither of them is better than the other in all scenarios. (At least that's my experience.)

I think it's worth noting that powershell is .NET object-based. This means you can interact with powershell objects from a .NET language but not, for example, python. To me this is the fundamental flaw of PS. It's a neat idea as long as you stay within their box, within their ecosystem. With Bash you get a wealth of tools because everything can handle text.

> With Bash you get a wealth of tools because everything can handle text.

And no autocomplete.

Re: A Saner Windows Command Line

#43

Powershell and its long winded cmdlets are really hard for me to like. I always fall back to cygwin on windows. I once wrote a PS script to set some power management options on a corporate laptop. The script was 11 lines long (vs 3 lines in Python), it was harder to read and understand. Even with ISE available it was much harder to write. I followed along with some exchange server tutorial where the prescribed easy w…

> I can't see what benefit PS has over cygwin bash but I'd love to hear ideas

For Exchange server administration, it is very useful.

Enter-PSSession give you a remote shell. There was news a while back that Microsoft was going to port OpenSSH to Windows, so things will improve.

I still prefer a Unix environment; tools like find are just a must-have. But compared to cmd.exe, which is the baseline many Windows people look at, it is a huge improvement.

For serious scripting, I prefer Perl, though.

Re: A Saner Windows Command Line

#44
post #16

Earlier quoted context omitted.

Learning Bash is just as cryptic. At least powershell function names have logic behind them.

I've only been working professionally with linux for 5-ish years, but i'd say that i'm still at the "2 googles per command" number for bash. Some of it stems from the fact that i just don't use it enough, but most of it from the fact that this shit just isn't intuitive. why is -b the flag for key length in ssh-keygen? Why is -v the flag for "don't include" in grep? I have those memorized now, but there is no way they…

> why is -b the flag for key length in ssh-keygen?

Because the length is given in "bits". I get your point, but that's a terrible example! :-)

Re: A Saner Windows Command Line

#45

>> Let's be honest. What many people think of as "the default Windows command line", cmd.exe, is atrociously bad. Selection is awkward, resizing is hard, the syntax is arcane, the list goes on. If you do nothing else, there are two things you can do to make the basic, vanilla experience bearable. Funny, from a guy coming from Windows to Unix I think the exact opposite. Each command comes with a bazillion options and…

This is the Android vs Apple paradigm. Customization available to a fault vs "appliance" that just plain works...

Each has their strengths and pain points. There's a reason normal people use Windows and Power Users gravitate to Linux.

Re: A Saner Windows Command Line

#46
I guess it's heretical to say this in some circles but I really like PowerShell, despite its faults. An object-oriented shell is a really good idea that saves a lot of time trying to munge texts with regular expressions and such.

That said the return semantics stink.

Re: A Saner Windows Command Line

#47
post #21

Why would you even want to make Windows command line better, instead of using a state of the art command line of Linux via a VM running in Windows, if you really cannot escape the Windows realm ?

Because a VM is overkill and won't allow you to interact with the Windows host.

Windows used to provide Interix which was a subsystem that allowed use to use quite a bunch of posix utilities and offered quite a very good integration with Windows. You could do quite a lot of things with it (we used it to convert a unix app to windows in record time) and it was IMO superior to Cygwin.

But that was 10 years ago, it disappeared at some point, being integrated somewhere in either the server version or the professional edition (named something like Unix Service for Windows) I lost track.

Considering all the work that MS is putting in interoperability those days, I'm wondering if it will not make a come back at some point.

Re: A Saner Windows Command Line

#48

Earlier quoted context omitted.

> Some of it stems from the fact that i just don't use it enough, but most of it from the fact that this shit just isn't intuitive. I have exactly the same problem. I use Linux since about 8 years but somehow I just don't use the commandline very often so I forget stuff all the time. Because of this I have half a dozen post-its glued to my monitor for all the grep/git/whatever tricks I just can't keep in my head. And…

Holy shit git! I need to reset my git repo to match origin, is it git reset hard --HEAD or git reset HEAD --hard? I'm like 90% sure they switch it with every update.

It's just git reset --hard. HEAD is implied.

Edit: To be more specific:

    git  # the executable
    reset  # the operation
    --hard # the type of reset being done (hard reset)
    HEAD  # where to reset *to*. Defaults to HEAD if not specified.

Re: A Saner Windows Command Line

#49
I think Powershell is a huge leap beyond Command. I just wish scripting was easier with it, speaking of its return values: http://stackoverflow.com/a/10288256/9744

Maybe there are better programming patterns for me to use here. Coming from traditional imperative languages, I was confused though, especially when I got to nests of functions, return values, and debug outputs. I mean, I later understood why things worked like they did -- I just had a hard time wrapping my code around the philosophy. Which is unusual for me to have with a language from Microsoft in their post-.NET era.

Re: A Saner Windows Command Line

#50

>> Let's be honest. What many people think of as "the default Windows command line", cmd.exe, is atrociously bad. Selection is awkward, resizing is hard, the syntax is arcane, the list goes on. If you do nothing else, there are two things you can do to make the basic, vanilla experience bearable. Funny, from a guy coming from Windows to Unix I think the exact opposite. Each command comes with a bazillion options and…

> I don't want to be logged into some terminal and have the Backspace not behave like a backspace (^H??). Yes, I'm sure I can make it work via some, again, configuration magic or enter emacs mode, but, again, why?

You don't have to do any magic for that normally. Even if using just xterm with bash, backspace should behave like backspace almost everywhere. You had some weird configuration there – possible you used the terminal of a greybeard?

Post reply on HN