Getting Started with PowerShell 6.0 in Linux [Beginner Guide]

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.95/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Aaron Kili

Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

24 Responses

  1. thedarlingsounds.Tumblr.com says:

    I got this website from my pal who told me regarding this web page and now this time I am visiting this web site and reading very informative articles at this place.

  2. Sylvio kaufmann says:

    I am with you Elio…

    Powershell on Linux / OSX is designed for cross-platform solutions

    so far you can create scripts they are running on all casual operating systems without the need to create a scripts in different languages for every os.

    this will make much things easier to handle without the knowledge of different scripting languages.

    between the main reason for developing ps on Linux is the “Microsoft azure switch” which connects the cloud with the local network. its an 100% based Linux developed from Microsoft and they don’t want to force windows administrators in more Linux then needed.

    and the project ps on Linux is much older than most of the people are thinking…its no idea of Microsoft…this project was born by Linux developers years ago.

    • Eddie G. says:

      I dunno about that last statement. According to this? Powershell started and was built by Microsoft:

      https://en.wikipedia.org/wiki/PowerShell

      And according to this page, which is ALSO from Microsoft, they were the ones to bring Powershell to Linux

      https://msdn.microsoft.com/powershell

      https://blogs.msdn.microsoft.com/powershell/2016/08/18/powershell-on-linux-and-open-source-2/

      not the other way around. most Linux users are NOT fans of Microsoft, so it stands to reason that they’re not fans of it’s products nor anything that tries to “muddy the waters” of the two. Trust me. I know. I’ve been using Linux since ’03 and I don’t relish nor look forward to any kind of mixing of the two platforms.

      Are there actual business use-cases for it? I’m sure there are, but those who have all-Linux shops…will have very little use for this since they’re already built out the way they want or need to be. Honestly? this still feels like more “Microsoft-ery” to try and get the masses to believe that there’s some deep seated love that’s been there for years.

      While Satya might have the right mindset?….there are still pending “patent” lawsuits that MS is currently attacking the open source and Linux community with. Until those ALL go away?…then nothing MS does will be considered as authentic and real.

      Hopefully someone will point this article out to the MS bigwigs and they’ll take to handling their legal side before they continue to try and make nice with open source. If you speak to a lot of Linux SysAdmins?….you’ll hear the same tone in all their replies / emails / IM messages / phone calls etc.

      There’s just no reason to be blending these two. A lot of times….when you make mention of the whole MS loves Linux topic?…..their reply will be “Why?”…..its just a case of “Too Little Too Late”….when Linux was ready, willing and able to play nice with MS they went in the opposite direction.

      Now that Open Source Software is just about EVERYWHERE?…..that’s the time MS wants to be friends?…well now we already HAVE our own Terminals…our own syntax…..our own apps and programs and also there are ways to get MS without having to install anything that will “attach” itself. (Thank god for Oracle’s VirtualBox….VMWare…and XenServer!) on the other side you have PlayOnLinux…or WINE…..

      • Aaron Kili says:

        @Eddie

        This is so interesting, ” most Linux users are NOT fans of Microsoft, so it stands to reason that they’re not fans of it’s products nor anything that tries to “muddy the waters” of the two. Trust me. I know. I’ve been using Linux since ’03 and I don’t relish nor look forward to any kind of mixing of the two platforms. ”

        This has happened to me too, ever since i switched to Linux, using Windows and other Microsoft products has been become undesirable, unless when forced to, due to unavoidable situations.

        However, the existence of the two platforms has been beneficial to the respective users out there, though the primary purpose/motive(commercial vs free, closed vs open source) of why they currently exist differs. But the a user will always choose, for what ever reason.

        Thanks for sharing your thoughts once again.

      • Sylvio kaufmann says:

        This was a answer i was expecting from Linux admins they don’t want to deal with Microsoft ^^

        In this post topic was powershell on Linux and the first time i ever heard of this was the project called pash for Linux and this project started 2012 by searching members for developing on github.

        For sure its late for the topic cooperation of Linux and windows but the last years both sides where unable to accept the others and both sides doesn’t wanted to do so, the Linux guys always wanted to be separated from windows, now the time has come to think new about it but none wants that as you say:

        “Now that Open Source Software is just about EVERYWHERE?…..that’s the time MS wants to be friends?…well now we already HAVE our own Terminals, our own syntax, our own apps and programs and also there are ways to get MS without having to install anything that will “attach” itself. (Thank god for Oracle’s VirtualBox, VMWare and XenServer!) on the other side you have PlayOnLinux or WINE”

        Between why you don’t like the patents on Microsoft software?…i really think its okay in cause of the following in 95% of all cases modified open source projects will not be published as the license says and for sure.

        When i spend months of time into a program i don’t want that anyone can take the code and build something with it to earn money and i don’t have something for this than “really useless fame behind a nickname where nobody knows my real name and so on” in this case every changes of every open source software should be available on the INTERNET…LOL you can forget about that…

        Everyone just wants the good points of open source not the bad points. in this double edged sword 99,9% of all pepple always forgot about the darkside of this and in 99,9% of all cases you could get the code but you never will recognize what the code is doing without being a professional developer

        So it doesn’t matter if you can read a book when you don’t understand the language, most of the open source junkies are miles away from understand the codes they can download!!! so its no worthy for them else the point…”its for free for me”. thats the point why Linux distributions has grown as much in the last few years.

        At the other side there is the bash on windows which do exactly the same shit for the Linux guys to take care of windows in their “language”…none in the ms sector cries about it…they think this is amazing…but there is cry in the Linux sector about powershell.

        I don’t understand why I use both systems and I am happy that the future will be powershell for all systems and for sure no really big environment is build as homogenius network. in most of the cases the administrators are forced to be informed and skilled in both worlds…so why the hell a similar language would be shitty?

        Microsoft wants to expand into the Linux sector and i don’t want to say that this is worse…

        Surely this will change much in the it-world but changes are unstoppable and the edge between windows and Linux will be vanish the next years in cause of the cooperation of canonical and Microsoft and this cooperation will go on as long this Indian is ceo at Microsoft and canonical earns money via this. even software developers in the Linux sector are interested in this.

        so the opinion of the end user is totally worthless and its useless to cry about!

        get it into your head and educate yourself or you will get outdated.

        • Eddie G says:

          You mistake me stating facts as complaining. Understand. The reason why Microsoft “Loves” Linux? is because they’re losing share in the business sector, as the databases that were once MS SQL are now MariaDB, NoSQL, or PostgreSQL.

          The file servers and print servers that were scheduled to be Windows Server 2012 / 2016 etc? are being converted or are being built out as Linux servers. (I’m not asking, I work for one of the biggest online “stores” and they’re 98.9% Linux servers.)

          So it’s not about crying, its about asking the age old question: “If it ain’t broke…..why fix it?”. The whole powershell topic is almost a moot point, there are those businesses that will adopt it and use it and those that won’t thank goodness we’ve already been told we WON’T be moving in that direction at all!

          For the ones who want it? most open source is available to them and will run on their hardware. You already know there are “limitations” when it comes to running Windows on older or legacy hardware. The points you state about open source and bad points.

          Understand, what one person considers a negative someone else might consider a positive, but be that as it may NO operating system is perfect. And while Linux may have it’s flaws? Microsoft has proven throughout the decades to be unworthy of calling itself a secure system, with the amount of trojans, viruses, malware, adware, and even ransomware that is designed to break it?

          Its not something you can rely on, at least for long term. The powershell issue is just another way for MS to “creep” into the open source communities and “dig in”. Go lookup “patent lawsuits” of MS vs Linux and tell me how can a company that claims to love you be trying to SUE you at the SAME TIME!?

          Why is no one speaking on that? No its all just “Wow…Microsoft is a Linux Foundation supporter now…they MUST have nothing but good intentions right?” yeah keep telling’ yourself that. And good luck if things go sour between them.

          As for me? I’ll stick with what I know, it works, its compatible with everything we use, we’ve hired people that KNOW the language and there’s no reason to fiddle with things. Accept the fact that not everyone is thinking like you do….just as I accept that not everyone will think like me.

          • Sylvio kaufmann says:

            I accept your opinion but did you ever realized that most viruses are not written to infect Linux systems because of the possibility to get useable they are sellable is much lower. WHY? i can tell you…viruses in the last time where always viruses they have to “activate” by the target itself…last ransomwares for example where all in makros the user have to accept the start…LOL this also can happen to you if you are stupid as hell as the windows users they have done that. most of the hackers are on search of the stupid…and stupidness the best operating system can not be undone…by the way check metasploit database for Linux exploits…you will drop out of your cloud ^^

            https://www.exploit-db.com/

            there are also viruses like locky for Linux systems and if you feel safe you where wrong when you look at the “exploit shellcode archive” 5/7 of the last 2 weeks are hacks for Linux…so forget about your opinion only windows is unsecure…

            exploits and viruses in most cases use code that is attacking not the kernel…in most cases third party programs are used to get access to the wanted data. so the securest kernel not saves you when your third party application got hacked.

            and your opinion about stalking from ms into the open source community…perhaps your right BUT…powershell is open source if your right that the community can understand the code they would find something that this is happening and Microsoft would lose his face for years but i don’t think this will happened.

          • Sylvio kaufmann says:

            The main reason for virus alarms on the internet is the stupidness of the most windows users they got problems with viruses in the past. for Linux its recommended to have some skills and know what you do.

            so the possibility to manually activate the viruses in macros is much lower then in windows and the other point is who uses free software? in many cases the users they haven’t got or don’t want to spend the money for software.

            So the possibility to get sellable data is much lower. so use to expense is not given in this case…hackers in the Linux sector in most cases are searching for exploits in Java or flash to be successful.

    • Aaron Kili says:

      @Sylvio

      Thanks for stopping by, and sharing these helpful thoughts.

  3. Martin R.A. says:

    @Eddie – Virtualization , Cloud computing :

    In my opinion Azure must be the main reason for Microsoft to embrace Linux and make SqlServer and powershell available on Linux. Looking on the rising percentage of Linux instances deployed into the different cloud offers, Microsoft MUST make this move to stay in the market.

    I have been doing Unix/Linux myself for many years and we should be glad to see the possibilities to compute without a Graphic head to operate since Windows server 2012.
    Microsoft windows have gone back to its ancestor VMS/OpenVMS and is enabling us to build test environments on Linux as well.

    Regards Martin R.A. – DK

    • Eddie G. says:

      @Martin R.A. – I’ve no doubt there’s an actual business case for this, from the cloud and Azure to containers and database manipulation. I was merely trying to point out that just because MS is giving “bits and pieces” of itself away, does NOT make them some holistic, and benevolent corporation that has the best interests of open source in mind.

      I agree with you that they’re jumping on this bandwagon to gain financial supremacy. And that’s the caveat, while the devs and sysadmins can “play” with this all they want, they should be remembering that MS has a “bad habit” of warming up to a company an then when everything is “champagne & roses” they literally wipe that company / IP / corporation out.

      Or else they just buy it and then dump it somewhere in the woods so it can die.Better to reject this “blending” for production environments….and keep it in the world of virtualizations and “not quite real” servers.

    • Aaron Kili says:

      @Martin

      According to what you have explained here- “In my opinion Azure must be the main reason for Microsoft to embrace Linux and make SqlServer and powershell available on Linux. Looking on the rising percentage of Linux instances deployed into the different cloud offers, Microsoft MUST make this move to stay in the market.”

      Surely, Azure the popular cloud computing platform and services with 38 Azure regions, more than any cloud provider is perhaps the main reason why Microsoft Loves Linux.

      Many thanks for the feedback.

  4. Eddie G. says:

    Being a longtime user of Linux, there’s no logical reason for this to even happen. I for one don’t use Powershell, and I have already mastered the Linux Command line. Why on Earth would I want to get this intertwined on my Linux systems that run so smoothly now? Nope.

    Leave this for those who might want to tinker with it and (possibly) break something that might require a complete re-install. The pro’s who “know”?….will avoid this like the Black Plague.

    Not Related….The Again….Maybe It Is?

    Its amazing to me that years ago, people who used Linux were reviled, shunned and made fun of. That is you didn’t have some sort of Microsoft certification you were “nobody”. That you were considered a Master if you could do things using the “cmd.exe” program.

    There was a time when if you tried to introduce Linux to your Windows systems you were blocked at every turn. You’d see articles and forums where people would ridicule you, call you names, and there would be all manner of arguments about why that “trash” called Linux should stay in it’s own backyard, and leave the “professionals” to do REAL work with Windows.

    Times have changed, to the point where the one company that was trying to stomp Linux out is embracing it as a friend!?. (be careful where that may lead!) I don’t need Powershell or anything else MS has to offer.

    We tried to play nice back then and the refused to, and that kind of forced the various developers to design their own work-arounds for things. Now that Linux is a self-contained, fully functional, OS that can hold its own….NOW you want to come over and act nice? Not buying it or falling for that. We here in Linux-land are ok….take your Powershell and go home. We don’t have any problems with that.

  5. Sparsh Gupta says:

    I have been following Tecmint blogs since past few months now. Although the articles and blogs help me learn new things and master my skills, I always get disappointed because ther’s no pdf’s for the same to download and print it or to keep it for later use. :(

  6. Joseph C Pietras says:

    Did not work for me on Ubuntu 16.04. First steps worked but then got this,

    nas:~ root# apt-get install install
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    E: Unable to locate package install`
    
    • Aaron Kili says:

      @Joseph

      You have used a wrong command, instead type the following after adding the repositories and updating packages’ sources list:

      apt-get install powershell
      OR
      apt-get install -y powershell to answer yes, automatically while installing.

      • Joseph C Pietras says:

        Ouch! Aaron you are correct and changing the command to “apt-get” instead of “apt” worked. Not sure why. In fact, when I ran the apt-get command to install powershell the output said to run “apt autoremove” in order to clean up some no longer needed packages.

        Also the apt documentation (apt –help; man apt) says it is a better front end to apt-get. I have not drilled into all the differences between the two commands.

  7. Elio Panting says:

    Well, you’ll need to understand that powershell for Linux, still in alpha version and as you pointed out, still a lot of work when compared to other Linux shells, powershell offers work with different platforms, the same code and scripts, works across, Linux, windows, OSX and powershell its an object-oriented programming language.

    If you try powershell on windows (full version) you’ll feel that its by far better, more exciting and productive features to operate a machine from the command line and importantly, for programming (scripting) purposes as well than it Linux counterparts.

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *