In Powershell, from memory:
ls | sort -property time
https://msdn.microsoft.com/en-us/powershell/reference/5.1/mi...In Powershell, from memory:
ls | sort -property time
https://msdn.microsoft.com/en-us/powershell/reference/5.1/mi...Know how am I supposed to know what type ls returns and what properties are available? For that matter, how am I supposed to know what type of object I'm dealing with? Time isn't displayed by the command and is different to LastWriteTime, how do I discover that it's a property?
So far in this ultra simple example powershell is looking over complicated and under featured.
The command you're looking for is Get-Member or gm. In this case 'ls | gm' will give you what you want. In much the same way that you were told to type 'man', rather than type all combinations of three letter words, you'll have to either pickup a book or read an article to learn a system. As a novice you can't expect to be proficient on day 1 now can you?
You're right that bash/unix requires some learning, but in my experience it requires less upfront learning and it plateaus fairly quickly, when I try and do something twice as complex it will only by 1.1 times as complicated. Powershell on the other hand doesn't seem to plateau, something twice as complex tends to be twice as complicated (or more).
LastAccessTime Property datetime LastAccessTime {get;set;}
LastAccessTimeUtc Property datetime LastAccessTimeUtc {get;set;}
LastWriteTime Property datetime LastWriteTime {get;set;}
LastWriteTimeUtc Property datetime LastWriteTimeUtc {get;set;}> In powershell from memory:
in that comment - I was on an iPad, and didn't have access to Powershell.
Reading HN :
irm https://news.ycombinator.com/rss
Stop all my VMs : get-vm | stop-vm
Stop all processes consuming more than 1GB: ps | ?{$_.WS -gt 1GB} | kill
Find all empty folders: ls -r | ?{-not($_|ls)}
All the PDFs that I downloaded this month: ls -r *.pdf | ?{$_.CreationTime -gt "4/1/2017"}There's a bunch of properties displayed by default, but if you want to see all of them:
ls | select *
Since ls (gci, get-childitem) can list Environemnt variables, Registry entries, etc (which is awesome) these all have different properties. ls Env: | select *
However I do see your point: the docs could be better about explaining that.- Writing a function
- Redirecting to the correct help topic
- Replicating all parameters and parameter sets so that tab completion works
Of course, if help and completion are irrelevant to you (wouldn't work correctly out of the box for bash either, I guess), then it just consists of writing a wrapper function instead of setting an alias.