Saturday, August 13, 2016

You Should Be Using PowerShell, Here are the Bare Minimums

I see most people avoiding PowerShell. I say if you just learn a few essential usage, it is a much easier environment to use, especially switching between MacOS and Windows.

Launching

Go to the start menu and type in powershell. If you frequent your Windows environment, I would "pin" this to Start or the Taskbar, and also start avoiding Cmd.

Some Basic Coolness

If you are going back and forth between IOS and Windows, it would be a bit more comfortable to use the PowerShell as it comes "out of the box" without the need for installing the "bash" shell and many of the Unix like commands are supported as "alias".

  • Like on the Unix shell you no longer have to type in /Users/myname/<wheatever> instead you'd be like in the familiar Unix environment like..
  • .
    • cd ~  works auend gret ysou tyoo /ura/<ccount>
    • cd ~/Downloads works!
    • cd~/Desktop works
    • ls works (this is an alias so cannot go too fancy like ls -lR)
    • From there if you do "open ." then you can open the Explorer at that directory.
  • You can now Ctrl-C and Ctrl-V if you just enable them. Right click the title bar of the PowerShell window for the Properties. Then open the Options menu and look for "Enable Ctrl key shortcuts." This was added in Windows 8

Some Peculiar Stuff

  • If you want to see environment variables, use "printenv"
  • One issue with environment variable. For example, let's say you want to use $JAVA_HOME as in MacOS, then you need to do $env:JAVA_HOME   I don't really like this, but so there

The Basic Idea

Like most anything, understanding the architecture and the basic philosophy of the design is the key to understanding whatever you are running into.

In terms of PowerShell, they tried to standardize basically on the REST type API Call style. So this is why they have commands like Get-This or Set-That.  So if you master those, then you can chain them together like you do with Unix pipes with a much more consistent "schema" they set up. 

The "help" is quite extensive and comprehensive as a result, so if you type in just about any phrase you think about, as "help something", it is a good way to move forward with more stuff.





No comments: