#navi(../)
* PowerShell、コマンドプロンプト、Linuxコマンド対応表 [#eecd1519]
PowerShellに対応するコマンドプロンプト(DOS)コマンド, Linuxコマンドの一覧表を記します。
良く使用すると思われるコマンドレットの一覧になります。

#contents
#htmlinsertpcsp(win-top.html,win-sp.html)

* コマンドレット対応表 [#z832ae3a]

|''No''|''セクション''|''PowerShell''|''コマンドプロンプト''|''Linux''|
|1|ファイル・ディレクトリ関連|Get-ChildItem|dir|ls, dir|
|2||Get-ChildItem -Name|dir /b|ls -1|
|3||Get-ChildItem | Where-Object {$_.Attribute -eq "Directory"}&br;Get-ChildItem  | Where-Object { $_.PSIsContainer }|dir /ad|ls -F | grep /|
|4||Get-ChildItem | Sort-Object LastWriteTime|dir /od|ls -ltr|
|5||Get-ChildItem | Sort-Object LastWriteTime -Descending|dir /o-d|ls -lt|
|6||Get-Content|type|cat|
|7||Copy-Item|copy|cp|
|8||Copy-Item -Recurse|xcopy&br;robocopy|cp -r|
|9||Remove-Item|del&br;erase|rm|
|10||Move-Item|move|mv|
|11||Rename-Item|ren|mv|
|12||Get-ChildItem -Recurse -Name|dir /b /s|find .|
|13||(Get-Content 対象ファイル名 | Measure-Object).Count|find /c /v ""|wc -l|
|14||Get-Location|cd&br;chdir|pwd|
|15||New-Item -ItemType Directory|mk&br;mkdir|mkdir|
|16||Set-Location|cd&br;chdir|cd|
|17||Remove-Item|rd&br;rmdir|rmdir|
|18||Compare-Object (Get-Content ファイル名) (Get-Content ファイル名)|fc|diff|
|19||←|robocopy|rsync|
|20||New-item -ItemType File ファイル名|type null > ファイル名|touch|
|21||(Get-Item ファイル名).LastWriteTime = (Get-Date)|copy ファイル名 +|touch|
|22|プロセス|Get-Process|tasklist|ps|
|23||Stop-Process|taskkill|kill|
|24||Get-Process | Where-Object ($_.ProcessName -eq "プロセス名") | % { Stop-Process $_.Id }|taskkill /im|killall|
|25|文字列操作|Select-String -CaseSensitive|findstr|grep|
|26||Select-String|findstr /i|grep -i|
|27||Get-Content ファイル名 | Sort-Object|sort|sort|
|28||Get-Content ファイル名 | Sort-Object | Get-Unique|-|sort | uniq|
|29||文字列.Replace("置換前文字列", "置換後文字列")&br;|-|tr|
|30|日付・時刻|Get-Date -Format yyyy/MM/dd|date /t&br;echo %DATE%|date '+%Y/%m/%d'|
|31||Get-Date -Format hh:mm:ss|time /t&br;echo %TIME%|date '+%T'|
|32|システム|[Environment]::OSVersion|ver&br;winver&br;systeminfo | findstr /b "OS"|uname -a|
|33||Get-WMIObject Win32_Processor | Format-List|systeminfo|cat /proc/cpuinfo|
|34||Get-WMIObject Win32_PhysicalMemory | Format-List|systeminfo|cat /proc/meminfo|
|35||-|logman|sar|
|36||-|logman|vmstat|
|37||-|logman|iostat|
|38||Get-Help コマンドレット|コマンド /?|man|
|39||←|hostname|hostname|
|40||←|taskmgr|top|
|41|環境・シェル関連|Exit-PSSession|exit|exit|
|42||Get-ChildItem env:|set|env|
|43||Get-ChildItem env:|set|printenv|
|44||Write-Host|echo|echo|
|45||Clear-Host|cls|clear|
|46||Set-Alias&br;New-Alias|doskey 別名=コマンド|alias|
|47||Get-History|-|history|
|48||Get-Random|%RANDOM%|$RANDOM|
|49||Get-Command|where|which|
|50||$lastexitcode|%ERRORLEVEL%|$?|
|51||$PID|-|$$|
|52|ユーザ|←|query user&br;query user /server:ホスト名|who -u|
|53||←|whoami|who am i|
|54|ネットワーク|←|ipconfig /a|ifconfig -a|
|55||←|netstat|netstat|
|56||←|arp|arp|
|57||←|ping|ping|
|58||←|tracert|traceroute|
|59||←|nslookup|nslookup|
|60|その他|$NULL|NUL|/dev/null|
|61||Start-Sleep|timeout /t 秒 /nobreak > nul|sleep|

#htmlinsertpcsp(win-btm.html,win-sp.html)

トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS