|
以下是Centos 7上运行powershell,安装的版本为v6.0.0-alpha.12
[root@bogon ~]# cat /etc/redhat-release
CentOS Linux release 7.1.1503 (Core)
[root@bogon ~]# powershell
PowerShell
Copyright (C) 2016 Microsoft Corporation. All rights reserved.
PS /root> $PSVersionTable
Name Value
---- -----
PSVersion 6.0.0-alpha
PSEdition Core
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 3.0.0.0
GitCommitId v6.0.0-alpha.12
CLRVersion
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
PS /root/shell> (Get-Command -CommandType Cmdlet).count #共有213个cmdlet
213
下面以几个命令来示例:
统计一个文件共有多少行
###linux命令
[root@bogon shell]# cat tecmint_monitor.sh | wc -l
117
###linux下使用powershell
PS /root/shell> Get-Content ./tecmint_monitor.sh | Measure-Object
Count : 117
Average :
Sum :
Maximum :
Minimum :
Property : linux
windows
从大到小排序
powershell
PS /root/shell> Get-ChildItem | Sort-Object -Descending Length | linux
[root@bogon shell]# ls -l | sort -n -r -k 5 | |
|
|