Home  >  Article  >  Backend Development  >  Getting Started Tutorial--Ubuntu PowerShell

Getting Started Tutorial--Ubuntu PowerShell

零下一度
零下一度Original
2017-06-17 11:19:131410browse

The following editor will bring you a detailed discussion of Ubuntu PowerShell (a must-read tutorial for beginners). The editor thinks it’s pretty good, so I’ll share it with you now and give it as a reference. Let’s follow the editor and take a look.

As early as August last year, PowerShell began to be open source and cross-platform, but it has never been tried. It is called PowerShell Core.

Here I intend to briefly introduce how to install and simple use, to provide a little entry help for students who don’t know PowerShell Core on Ubuntu yet, thank you for your support~

PowerShell Core is an open source cross-platform task automation and configuration management system developed by Microsoft that runs on .Net Core.

1. Install PowerShell Core on Ubuntu 16.04

a) Import the public repository GPG key

curl packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -

b )Register Microsoft Ubuntu repository

curl packages.microsoft.com/config/ubuntu/16.04/prod.list | sudo tee /etc/apt/sources.list.d/microsoft.list

c)UpdatePackage

sudo apt-get update

d)Install PowerShell

sudo apt-get install -y powershell

2. Using PowerShell Core

a) Launch PowerShell and check PowerShell version:

b) Added some integrationvariables, can be used to determine and check the system version:

c) Get available modules:

d) Utilizing pipes:

e) Using aliases:

f) Using .NETClass Library

3. Basic command comparison table

4. Notes on PowerShell Core on Linux

a) Case sensitivity

Windows ignores case , so PowerShell on Windows is also ignored. However Linux is case sensitive. Therefore, PowerShell on Linux generally ignores case, but some special values ​​at the operating system level are case-sensitive (such as the names of some environment variables):

b) Alias

PowerShell on Windows has some Linux-type aliases, such as ls, cat, man, etc. However, these aliases no longer exist on Linux to prevent conflicts. For example, ls It is also an alias of Get-ChildItem in Windows PowerShell, but cannot be found in Linux PowerShell Core:

##5. Use Visual Studio Code for PowerShell Script development

a) First install Visual Studio:

https://code.visualstudio.com/.

b) Add the PowerShell plug-in:

#c) Now using this to write PowerShell scripts is similar to ISE in Windows:

d) For more usage details, please see: code.visualstudio.com/docs.

The above is the detailed content of Getting Started Tutorial--Ubuntu PowerShell. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn