このエントリーをはてなブックマークに追加


コマンドプロンプト、PowerShell、Linuxコマンド比較・対応表

コマンドプロンプト(DOS)コマンドに対応するPowerShell, Linuxコマンドの一覧表を記します。
良く使用すると思われるコマンドの一覧になります。


コマンド対応表

NoセクションコマンドプロンプトPowerShellLinux
1ファイル・ディレクトリ関連dirGet-ChildItemls, dir
2dir /bGet-ChildItem -Namels -1
3dir /adGet-ChildItem | Where-Object {$_.Attribute -eq "Directory"}
Get-ChildItem | Where-Object { $_.PSIsContainer }
ls -F | grep /
4dir /odGet-ChildItem | Sort-Object LastWriteTimels -ltr
5dir /o-dGet-ChildItem | Sort-Object LastWriteTime -Descendingls -lt
6typeGet-Contentcat
7copyCopy-Itemcp
8xcopy
robocopy
Copy-Item -Recursecp -r
9del
erase
Remove-Itemrm
10moveMove-Itemmv
11renRename-Itemmv
12dir /b /sGet-ChildItem -Recurse -Namefind .
13find /c /v ""(Get-Content 対象ファイル名 | Measure-Object).Countwc -l
14cd
chdir
Get-Locationpwd
15mk
mkdir
New-Item -ItemType Directorymkdir
16cd
chdir
Set-Locationcd
17rd
rmdir
Remove-Itemrmdir
18fcCompare-Object (Get-Content ファイル名) (Get-Content ファイル名)diff
19robocopyrsync
20type null > ファイル名New-item -ItemType File ファイル名touch
21copy ファイル名 +(Get-Item ファイル名).LastWriteTime = (Get-Date)touch
22プロセスtasklistGet-Processps
23taskkillStop-Processkill
24taskkill /imGet-Process | Where-Object ($_.ProcessName -eq "プロセス名") | % { Stop-Process $_.Id }killall
25文字列操作findstrSelect-String -CaseSensitivegrep
26findstr /iSelect-Stringgrep -i
27sortGet-Content ファイル名 | Sort-Objectsort
28-Get-Content ファイル名 | Sort-Object | Get-Uniquesort | uniq
29-文字列.Replace("置換前文字列", "置換後文字列")
tr
30日付・時刻date /t
echo %DATE%
Get-Date -Format yyyy/MM/dddate '+%Y/%m/%d'
31time /t
echo %TIME%
Get-Date -Format hh:mm:ssdate '+%T'
32システムver
winver
systeminfo | findstr /b "OS"
[Environment]::OSVersionuname -a
33systeminfoGet-WMIObject Win32_Processor | Format-Listcat /proc/cpuinfo
34systeminfoGet-WMIObject Win32_PhysicalMemory | Format-Listcat /proc/meminfo
35logman-sar
36logman-vmstat
37logman-iostat
38コマンド /?Get-Help コマンドレットman
39hostnamehostname
40taskmgrtop
41環境・シェル関連exitExit-PSSessionexit
42setGet-ChildItem env:env
43setGet-ChildItem env:printenv
44echoWrite-Hostecho
45clsClear-Hostclear
46doskey 別名=コマンドSet-Alias
New-Alias
alias
47-Get-Historyhistory
48%RANDOM%Get-Random$RANDOM
49whereGet-Commandwhich
50%ERRORLEVEL%$lastexitcode$?
51-$PID$$
52ユーザquery user
query user /server:ホスト名
who -u
53whoamiwho am i
54ネットワークipconfig /aifconfig -a
55netstatnetstat
56arparp
57pingping
58tracerttraceroute
59nslookupnslookup
60その他NUL$NULL/dev/null
61timeout /t 秒 /nobreak > nulStart-Sleepsleep


トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2016-01-16 (土) 13:17:31