Live data from Hacker News

Looking Forward: Support for Secure Shell

blogs.msdn.com

351–360 of 404 posts

Re: Looking Forward: Support for Secure Shell

#351
post #343
post #320

Earlier quoted context omitted.

Probably not. In my experience it's not so much about things being impossible elsewhere, just that PowerShell can often be better at fiddling in a REPL until you got the results you wanted, in a way. The point where you need (or want) to upgrade to a more powerful language is IMHO earlier in bash than in PowerShell². PowerShell handles objects like Unix utilities handle text. You get a lot more orthogonality in comma…

Your comment was useful, so not totally in vein :-) Just incited me to have a little look at powershell (read through [0], useful intro). It looks nice, I can definitely see the utility in have a simple object model for transferring information between processes. In nix land you get pretty good at extracting data from simple text forms, though sometimes it's harder than it should be. One thing that jumped out at me t…

You found three ways of doing things that all do filtering at a different level. The -Filter parameter employs filtering on the provider side¹ of PowerShell, i.e. in the part that queries the file system directly. Essentially your filter is probably passed directly to FindFirstFile/FindNextFile which means that fewer results have to travel fewer layers. The -Path parameter (implied in ls .exe as it's the first parameter) works within the cmdlet itself, which is also evident in that it supports a slightly different wildcard syntax (you can use character classes here, but not in -Filter) because it is already over in PowerShell land. The slowest option here pushes filtering yet another layer up, by using the pipeline, so you get two cmdlets, passing values to each other and that's some overhead as well, of course. Note that the most flexible option here is by combining Get-ChildItem with Where-Object, whereas the direct equivalent in Unix would probably be find which replicates some of ls' functionality² to do what it does, which probably places it in a very similar spot to ls, performance-wise.

It's not uncommon for the most flexible option to be the slowest, though. In my own tests my results were 18 ms, 115 ms and 140 ms for doing those commands in $Env:Windir\system32, so the difference wasn't as big as in your case. For a quick command on the command line I feel performance is adequate in either case, unless you're doing things with very large directories. If you handle a large volume of data, regardless of whether it's files, lines, or other objects, you probably want to filter as much as you can as close to the source as you can – generally speaking.

As for buffering ... I'm not aware of, unless the cmdlet needs to have complete output of the previous one to do its work. Every result from a pipeline is passed individually from one cmdlet to the next by default. Some cmdlets do* buffer, though, e.g. Get-Content has a -ReadCount parameter that controls buffering in the cmdlet (man gc -param readcount). Sort-Object and Group-Object are the most common (for me at least) that always need complete output of the stage before to return anything, for quite obvious reasons.

However, even though I did some work on Pash, the open-source reimplementation of PowerShell, I'm not terribly well-versed in its internal workings, so take the buffering part with a grain of salt.

As for completeness, well, the Unix ecosystem has an enormous edge here, simply by having been there for decades and amassing tools and utilities. Since PowerShell was intended for system administrators you can expect nearly everything needed there to have PowerShell-native support. This includes files, processes, services, event logs, active directory, and various other things I know little to nothing about. Get-Command -Verb Get gives you a list of things that are supported directly that way. It seems like even configuration things like network, disks and other such things are supported by now. At Microsoft there's a rule, I think, that every new configuration GUI in Windows Server has to be built on PowerShell. Which means, everything you can do in the GUI, you can do in PowerShell, and I think you can in some cases even access the script to do the changes you just made in the GUI – e.g. for doing the same change on a few hundred machines at once, or whatever.

Of course, you can just work with any collection of .NET objects by virtue of the common cmdlets working with objects (gcm -noun object). For me, whenever there is no native support, .NET is often a good escape hatch, that in many cases isn't terribly inconvenient to use. You also have more control over what exactly happens at that level, because you're one abstraction level lower. As a last resort, it's still a shell. It can run any program and get its output. Output from native programs is returned as string[], line by line, and in many cases that's not worse than with cmd or any Unix shell.

_____

¹ Keep in mind, the file system is just one provider and there are others, e.g. registry, cert store, functions, variables, aliases, environment variables that work with exactly the same commands. That's why ls is an alias for Get-ChildItem and there is no Get-File, because those commands are agnostic of the underlying provider.

² So much for do one thing – but understandable, because ls' output is not rich enough to filter for certain things further down in the pipeline.

Re: Looking Forward: Support for Secure Shell

#352

Earlier quoted context omitted.

> Who uses vi-mode in the shell? There's at least a dozen of us. It's my wishlist :) > Windows could do a lot better than curses by > providing easy means to pop MFC dialogs from > the shell to prompt the user. When you work in an environment with a lot of hosts, Windows is a laborious partner. You need to open remote desktops and click windows to push the OS around. With unix you often have processes that start out…

Additionally, popping up GUI dialog windows over slow network links will get very old very fast.

Console interaction shines particularly for high-latency liks. Mainframe/mini interfaces were particularly strong - your buffer could get many characters ahead of the display, but you could have complete confidence that everything would work out.

Re: Looking Forward: Support for Secure Shell

#353

Earlier quoted context omitted.

Couldn't agree more. As a die hard Unix guy and ex Slashdot-esque zealot (colloquially a bit of a twat). Yet I'm knocking out PowerShell all the time now and dread having to log into the pile of CentOS kit I have lying around. It is arcane. Even after 15 years I spend most of my time in the manpages or working out another damn config format. Literally did a two liner to scrape a web page, parse it and call a REST end…

Sounds awesome, how would you recommend someone get started with PS? I'm CLI-only dev, use Node, code tons of front-end but all I use to do is CMDer, VIM, and SSH all running together.

Fire up PowerShell ISE (comes with windows) as administrator and type:

    Update-Help
This will download all the help.

Then you can type "Get-Help About_" and hit tab to see the master topic lists.

Re: Looking Forward: Support for Secure Shell

#354
"Those who don't understand Unix are condemned to reinvent it, poorly." – Henry Spencer

Basically, bit by bit it seems Microsoft are realising there is a ton of stuff they need to take from the unix environment.

The comments here about how awesome PowerShell and the other tools within all are seem to focus on everything being an object rather than being text.

So, we could fix that by basically providing a "Ruby shell" in one sweep. You go through the standard utilities you have on unix systems, provide them as Ruby methods on various objects (the Ruby stdlib has a great many) and provide a means to navigate a file system easily, and basically you have the beginnings of an object-orientated shell with the support of the traditional 30+ year old command line utilities.

What is it I am missing? This feels all a little reminiscent of when Microsoft got all giddy about providing symbolic links... well... yeah... I mean... what?

Re: Looking Forward: Support for Secure Shell

#355
post #326

Earlier quoted context omitted.

Power shell is ok but MS DOS terminal needs an update: it has several limitations about fonts, encoding and missing libs that make it the worst terminal experience imho. Ah also POSIX compliance could simplify the life of those who develop on Windows. I tryed to develop on Windows for many years, I tryed hard but you are always missing some feature that on Unix is basic.

For the love of... just let me drag it wider than an old vt110 terminal!

That's all done in Windows 10.

Re: Looking Forward: Support for Secure Shell

#356
post #221

Earlier quoted context omitted.

I did find an open source implementation here: http://pash.sourceforge.net/ Don't know if it's any good --- never tried it; it says it's about half complete, but I don't know if it's a useful half. After looking at the docs, you could do a lot of what Powershell does with Unix shells; you'd need a different set of conventions, where instead of using unformatted text as an intermediate format you used a streamable tab…

Isn't this just complaining you want a different tool? The entire Powershell format depends on, amongst other things, the object interface being sane, existing, and usable. The whole point of the GNU system was working around the usual "I can see it here, need this bit, and want to put it there". If you need to do something really specific a lot, you write a tool which does that.

Yes, precisely. The main thing would be to do is to define the stream format, and then persuade people to actually use it.

The point of the exercise is that the traditional Unix pipelinable commands have standardised on unstructured textual data. Powershell has standardised on structured tabular data, which is what lets you do the cool things.

Re: Looking Forward: Support for Secure Shell

#357

Earlier quoted context omitted.

I did find an open source implementation here: http://pash.sourceforge.net/ Don't know if it's any good --- never tried it; it says it's about half complete, but I don't know if it's a useful half. After looking at the docs, you could do a lot of what Powershell does with Unix shells; you'd need a different set of conventions, where instead of using unformatted text as an intermediate format you used a streamable tab…

> And if I never have to parse the output of ls -l using cut again, I will be a happy person. Try stat instead, e.g. $ stat -c 'NAME: %n; OWNER: %U, SIZE: %s' * also supports --printf (see man stat).

It's not standard enough --- coreutils and OSX's work differently.

Re: Looking Forward: Support for Secure Shell

#358
post #303

Earlier quoted context omitted.

They also generally have more (useful) features than the BSD ones.

Not only that but they include more documentation inside the binary. Someone also pointed out to me one time that some features in some GNU utils are only possible to have if they are implemented in the binary, rather as a separate program.

Well, generally speaking nothing is impossible, but it's often more efficient to put the extra features in the same binary. However this "bloat" is nothing compared to your typical desktop or programming environment.

Re: Looking Forward: Support for Secure Shell

#359
post #316

Earlier quoted context omitted.

You are right. The guy that wrote PowerShell says that UNIX is document oriented configuration while windows is API oriented configuration. To get into it in any depth you have to approach windows programmatically. The most power is through C\C++...to be a good windows admin you need to read the docs about how you interact with different subsystems, even if you aren't going to code against them.

> You are right. The guy that wrote PowerShell says that UNIX is document oriented configuration while windows is API oriented configuration. That's an interesting way of putting it. I strongly prefer the Unix way then,(just avoid turing complete config languages).

After coding for several years, the two aren't all that different.

I'm not saying that I think that the UNIX WAY is ever going to go away...but I do think that extreme scale makes the programmatic approach to configuration make more sense. Instead of treating every system as a "system" you treat it as a simple programmable node among thousands of others. You are already starting to see Linux go this way with systemD. The stuff that the CoreOS people are doing with etcD, fleet, and flannel are really the future of *NIX.

Please cut me some slack...I'm NOT TRYING TO ARGUE ABOUT SYSTEMD. I'm just saying that it's oriented towards developers using API's. That's one of the reasons why admins who are used to the "one true way" dislike it so much. And they should have options if they don't want to use it. I'm just saying that cloud scale deployments are driving changes to infrastructure to make it more "programmable". I'm not even saying it's "right"...Its just a observation.

Re: Looking Forward: Support for Secure Shell

#360
post #88

Earlier quoted context omitted.

I don't know many sysadmins who would use Cygwin to handle remote access to production servers.

They're over at /r/sysadmin.

there's a dude there asking how to pick an email address. i'm pretty sure it's serious.

" rel="nofollow">http://www.reddit.com/r/sysadmin/comments/38ba26/professiona...

Post reply on HN