以下是Centos 7上运行powershell,安装的版本为v6.0.0-alpha.12
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
[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
|
下面以几个命令来示例:
统计一个文件共有多少行
1
2
3
4
5
6
7
8
9
10
11
|
###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 |
本文转自cix123 51CTO博客,原文链接:http://blog.51cto.com/zhaodongwei/1884338,如需转载请自行联系原作者