From 0ea02559aa66e93d57ad03c39fdf394261ef1098 Mon Sep 17 00:00:00 2001 From: jasminepeng Date: Tue, 21 Feb 2017 16:53:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=A1=E5=AF=B9=E5=AE=8C=E6=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 校对完毕 --- ...ng Started with PowerShell 6.0 in Linux.md | 74 +++++++++---------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/translated/tech/20170216 Getting Started with PowerShell 6.0 in Linux.md b/translated/tech/20170216 Getting Started with PowerShell 6.0 in Linux.md index 9cf21e1e01..18d1b4a74a 100644 --- a/translated/tech/20170216 Getting Started with PowerShell 6.0 in Linux.md +++ b/translated/tech/20170216 Getting Started with PowerShell 6.0 in Linux.md @@ -1,21 +1,21 @@ -Linux 使用 PowerShell 6.0 入门 [新手指南] +Linux 上 PowerShell 6.0 使用入门 [新手指南] ============================================================ -在微软爱上 Linux 之后(众所周知「Microsoft Loves Linux」),PowerShell 从一个原本只有 Windows 才能使用的组件,于2016年8月18日开源并且能够跨平台,已经可以在 Linux 和 macOS 中使用。 +在微软爱上 Linux 之后(众所周知 **Microsoft Loves Linux**),**PowerShell** 原本只是 Windows 才能使用的组件,于 2016 年 8 月 18 日开源并且跨平台,已经可以在 Linux 和 macOS 中使用。 -PowerShell 是一个微软开发的自动化任务和配置管理系统。它基于 .NET 框架,由命令行语言解释器(shell)和脚本语言组成。 +**PowerShell** 是一个微软开发的自动化任务和配置管理系统。它基于 .NET 框架,由命令行语言解释器(shell)和脚本语言组成。 -PowerShell 提供 COM (Component Object Model) 和 WMI (Windows Management Instrumentation) 的完全访问來在本地或远程 Windows 系统中 [执行系统任务][1],就像 WS-Management 或 CIM (Common Information Model)实现远程 Linux 和网络设备的管理一样。 +PowerShell 提供对 **COM** (**Component Object Model**) 和 **WMI** (**Windows Management Instrumentation**) 的完全访问,从而允许系统管理员在本地或远程 Windows 系统中 [执行管理任务][1],以及对 WS-Management 和 CIM(**Common Information Model**)的访问,实现对远程 Linux 系统和网络设备的管理。 -通过这个框架,管理任务基本上由称为 cmdlets(发音 command-lets)的 .NET 类执行。就像 Linux 的 shell 脚本一样,用户可以通过按照一定的规则将 cmdlets 写入文件来制作脚本或可执行文件。这些脚本可以独立用作 [命令行程序或工具][2]. +通过这个框架,管理任务基本上由称为 **cmdlets**(发音 command-lets)的 **.NET** 类执行。就像 Linux 的 shell 脚本一样,用户可以通过按照一定的规则将 **cmdlets** 写入文件来制作脚本或可执行文件。这些脚本可以用作独立的[命令行程序或工具][2]。 ### 在 Linux 系统中安装 PowerShell Core 6.0 -要在 Linux 中安装 PowerShell Core 6.0,我们将会用到微软官方的仓库,它允许我们通过 [apt-get][3]、[yum][4] 等最流行的几个包管理器来安装。 +要在 Linux 中安装 **PowerShell Core 6.0**,我们将会用到微软 Ubuntu 官方仓库,它允许我们通过最流行的 Linux 包管理器工具,如 [apt-get][3]、[yum][4] 等来安装。 #### 在 Ubuntu 16.04 中安装 -首先,导入 GPG 密钥,然后将微软的 Ubuntu 仓库添加到 APT 的源中来安装 PowerShell: +首先,导入公共仓库 **GPG** 密钥,然后将 **Microsoft Ubuntu** 仓库注册到 **APT** 的源中来安装 **PowerShell**: ``` $ curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add - @@ -35,7 +35,7 @@ $ sudo apt-get install -y powershell #### 在 CentOS 7 中安裝 -首先,将微软的 RedHat 仓库添加到 YUM 源中然后安装 PowerShell: +首先,将 **Microsoft RedHat** 仓库注册到 **YUM** 包管理器仓库列表中,然后安装 **PowerShell**: ``` $ sudo curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/microsoft.repo @@ -44,7 +44,7 @@ $ sudo yum install -y powershell ### 如何在 Linux 中使用 PowerShell Core 6.0 -在这一节中,我们将会简单介绍下 PowerShell;我们将会看到如何启动 PowerShell,如何运行一些基础命令,如何操作文件、目录和进程。然后学习怎样列出所有可用的命令、显示命令帮助和别名。 +在这一节中,我们将会简单介绍下 **PowerShell**;我们将会看到如何启动 PowerShell,运行一些基础命令,操作文件、目录和进程。然后学习怎样列出所有可用的命令、显示命令帮助和别名。 输入以下命令来启动 PowerShell: @@ -55,7 +55,7 @@ $ powershell ![Start Powershell in Linux](http://www.tecmint.com/wp-content/uploads/2017/02/start-powershell.png) ][5] -在 Linux 中开启 PowerShell +*在 Linux 中启动 PowerShell* 你可以通过以下命令来查看 PowerShell 版本: @@ -66,9 +66,9 @@ $PSVersionTable ![Check Powershell Version](http://www.tecmint.com/wp-content/uploads/2017/02/check-powershell-version.png) ][6] -查看 PowerShell 版本 +*查看 PowerShell 版本* -在 Linux 中运行 PowerShell 基础命令。 +在 Linux 中运行基本的 PowerShell 命令。 ``` get-date [# 显示当前日期] @@ -82,7 +82,7 @@ get-location [# 显示当前工作目录] ``` new-item tecmint.tex -OR +或者 "">tecmint.tex ``` @@ -96,7 +96,7 @@ get-content tecmint.tex ![Create New File in Powershell](http://www.tecmint.com/wp-content/uploads/2017/02/Create-New-File-in-Powershell.png) ][7] -在 PowerShell 中创建新文件 +*在 PowerShell 中创建新文件* 2. 在 PowerShell 中删除一个文件 @@ -108,7 +108,7 @@ get-content tecmint.tex ![Delete File in Powershell](http://www.tecmint.com/wp-content/uploads/2017/02/Delete-File-in-Powershell.png) ][8] -在 PowerShell 中删除一个文件 +*在 PowerShell 中删除一个文件* 3. 创建目录 @@ -122,9 +122,9 @@ ls ![Create Directory in Powershell](http://www.tecmint.com/wp-content/uploads/2017/02/create-new-directory-in-Powershell.png) ][9] -在 PowerShell 中创建目录 +*在 PowerShell 中创建目录* -4. 列出一个包括文件/目录的权限(文件类型)、最后修改时间等詳細信息的列表,使用以下命令: +4. 执行长列表,列出文件/目录详细情况,包括模式(文件类型)、最后修改时间等,使用以下命令: ``` dir @@ -133,7 +133,7 @@ dir ![Directory Long Listing in Powershell](http://www.tecmint.com/wp-content/uploads/2017/02/Directory-Long-Listing-in-Powershell.png) ][10] -列出目录 +*Powershell 中列出目录长列表* 5. 显示系统中所有的进程: @@ -144,9 +144,9 @@ get-process ![View Running Processes in Powershell](http://www.tecmint.com/wp-content/uploads/2017/02/View-Running-Processes-in-Powershell.png) ][11] -在 PowerShell 中显示运行中的进程 +*在 PowerShell 中显示运行中的进程* -6. 通过给定的名称获取正在运行的进程/进程组,将进程名作为参数传给命令,就像这样: +6. 通过给定的名称查看正在运行的进程/进程组细节,将进程名作为参数传给上面的命令,如下: ``` get-process apache2 @@ -155,16 +155,16 @@ get-process apache2 ![View Specific Process in Powershell](http://www.tecmint.com/wp-content/uploads/2017/02/View-Specific-Process-in-Powershell.png) ][12] -在 PowerShell 中查看指定的进程 +*在 PowerShell 中查看指定的进程* -输出上方的单位的意思: +输出中各部分的含义: -1. NPM(K) – 进程总共使用的非分页内存,单位:K。 -2. PM(K) – 进程总共使用的可分页内存,单位:K。 -3. WS(K) – 进程的工作集大小,单位:K,工作集包括进程将要访问的页。 -4. CPU(s) – 进程所用的总计算时间,单位:秒。 -5. ID – 进程 ID (PID). -6. ProcessName – 进程名称。 +* NPM(K) – 进程总共使用的非分页内存,单位:Kb。 +* PM(K) – 进程总共使用的可分页内存,单位:Kb。 +* WS(K) – 进程的工作集大小,单位:Kb,包括进程引用到的内存页。 +* CPU(s) – 进程所用的处理器时间,单位:秒。 +* ID – 进程 ID (PID). +* ProcessName – 进程名称。 7. 想要了解更多,获取 PowerShell 命令列表: @@ -175,9 +175,9 @@ get-command ![List Powershell Commands](http://www.tecmint.com/wp-content/uploads/2017/02/List-Powershell-Commands.png) ][13] -列出 PowerShell 的命令 +*列出 PowerShell 的命令* -8. 想知道如何使用一个命令,查看它的帮助(类似于 Unix/Linux 中的 man);举个例子,你可以这样获取命令「Describe」的帮助: +8. 想知道如何使用一个命令,查看它的帮助(类似于 Unix/Linux 中的 man);举个例子,你可以这样获取命令 **Describe** 的帮助: ``` get-help Describe @@ -186,7 +186,7 @@ get-help Describe ![Powershell Help Manual](http://www.tecmint.com/wp-content/uploads/2017/02/Powershell-Help-Manual.png) ][14] -PowerShell 帮助手册 +*PowerShell 帮助手册* 9. 显示所有命令的别名,輸入: @@ -197,9 +197,9 @@ get-alias ![List Powershell Command Aliases](http://www.tecmint.com/wp-content/uploads/2017/02/List-Powershell-Command-Aliases.png) ][15] -列出 PowerShell 命令别名 +*列出 PowerShell 命令别名* -10. 最后,但并非不重要的,显示命令历史记录(曾运行过的命令的列表): +10. 最后,不过也很重要,显示命令历史记录(曾运行过的命令的列表): ``` history @@ -208,13 +208,13 @@ history ![List Powershell Commands History](http://www.tecmint.com/wp-content/uploads/2017/02/List-Powershell-Command-History.png) ][16] -显示 PowerShell 历史记录 +*显示 PowerShell 命令历史记录* -到此为止!现在,在这篇文章里,我们向你展示了如何在 Linux 中安装微软的 PowerShell Core 6.0。我认为,与拥有更好、更多令人激动和富有成效的特性的,通过命令行和更为重要的编程(脚本)来操作机器的传统 Unix/Linux 的 shell 相比,PowerShell 还有很长的路要走。 +就是这些了!在这篇文章里,我们展示了如何在 Linux 中安装**微软的 PowerShell Core 6.0**。在我看来,与传统 Unix/Linux 的 shell 相比,PowerShell 还有很长的路要走。到目前为止,前者为从命令行操作机器,更重要的是,编程(写脚本),提供了更好、更多令人激动和富有成效的特性。 -查看 PowerShell 的 GitHub 倉庫:[https://github.com/PowerShell/PowerShell][17] +查看 PowerShell 的 GitHub 仓库:[https://github.com/PowerShell/PowerShell][17]。 -你可以在评论中分享你的观点。 +请在评论中分享你的观点。 --------------------------------------------------------------------------------