i

各シェル環境のコマンドツール比較

注意: シェル環境の詳細な特徴や使い方の説明は シェル環境の特徴 ページに移動しました。 このページではコマンドリファレンス表のみを掲載しています。

各環境のコマンドツール比較

bash/cmd/powershell<nushell≦rust
ネイティブ環境は無視。
nushellは組み込みの統計システム仕様。
Rust製ツールは向いてる。

基本コマンド

表2.1: 各シェル環境における基本的なコマンド一覧と比較
機能 bash cmd powershell< nushell≦ rust
ディレクトリ変更 cd
(change directory)
cd Set-Location / cd cd zoxide
ディレクトリ一覧 ls dir Get-ChildItem / dir / ls ls eza
現在のディレクトリ表示 pwd cd (引数なし) Get-Location / pwd pwd -
ファイル内容表示 cat type Get-Content / cat / type open / cat bat
画面消去 clear cls Clear-Host / cls clear -
コマンド履歴 history doskey /history Get-History / history history -
ディレクトリ作成 mkdir mkdir / md New-Item / mkdir mkdir -
ファイルコピー cp copy Copy-Item / cp / copy cp -
ファイル移動/名前変更 mv move / rename / ren Move-Item / Rename-Item / mv / move mv -
ファイル削除 rm del / erase Remove-Item / del / rm rm -
ディレクトリ削除 rmdir / rm -r rmdir / rd Remove-Item / rmdir / rd rm -r -

ファイル操作コマンド

表3.1: 各シェル環境におけるファイル操作コマンドの比較
機能 bash cmd.exe (Windows) PowerShell Nushell (Nu) rust
ファイル検索 find / locate where / findstr Get-ChildItem -Recurse | Where-Object ls **/* | where name =~ pattern fd / ripgrep
ファイル内テキスト検索 grep findstr Select-String open | lines | where $it =~ pattern ripgrep
ファイル比較 diff fc Compare-Object diff (プラグイン) difftastic
ファイル属性変更 chmod attrib Set-ItemProperty chmod (外部コマンド) -
ファイル所有者変更 chown icacls Set-Acl chown (外部コマンド) -
シンボリックリンク作成 ln -s mklink New-Item -ItemType SymbolicLink ln -s (外部コマンド) -
ファイルサイズ確認 ls -l / du dir (Get-Item).Length ls | get size dust / dua

テキスト処理コマンド

テキスト処理コマンド
機能 bash cmd.exe (Windows) PowerShell Nushell (Nu) rust
テキスト検索 grep findstr Select-String find-in-string ripgrep
テキスト置換 sed - -replace / $_.Replace() str replace sd / amber
テキスト整形 fmt / awk - Format-* fmt -
ソート sort sort Sort-Object sort-by -
行数カウント wc -l find /c /v "" (Get-Content).Count lines | length tokei
テキスト差分 diff fc Compare-Object diff (プラグイン) difftastic
先頭/末尾の表示 head / tail - Select-Object -First/-Last first / last -
テキスト分割 cut / awk - -split split -

システム管理コマンド

システム管理コマンド
機能 bash cmd.exe (Windows) PowerShell Nushell (Nu) rust
プロセス一覧 ps tasklist Get-Process ps procs
プロセス終了 kill taskkill Stop-Process kill (外部コマンド) -
システム情報 uname -a / lsb_release systeminfo Get-ComputerInfo sys sysinfo
ディスク使用量 df dir C: / diskpart Get-PSDrive sys | get disks dua / dust
メモリ使用状況 free systeminfo Get-Process | Measure-Object sys | get mem bottom
サービス管理 service / systemctl sc / net Get-Service / Start-Service 外部コマンド -
シャットダウン shutdown shutdown Stop-Computer 外部コマンド -
ユーザー管理 useradd / usermod net user Get-LocalUser 外部コマンド -

ネットワークコマンド

ネットワークコマンド
機能 bash cmd.exe (Windows) PowerShell Nushell (Nu) rust
IPアドレス確認 ifconfig / ip addr ipconfig Get-NetIPAddress sys | get net -
疎通確認 ping ping Test-Connection ping (外部コマンド) -
ネットワーク経路 traceroute tracert Test-NetConnection -TraceRoute 外部コマンド -
DNS検索 nslookup / dig nslookup Resolve-DnsName 外部コマンド dog
ファイルダウンロード wget / curl - Invoke-WebRequest http get curl-rs
ポート確認 netstat / ss netstat Get-NetTCPConnection 外部コマンド -
ファイル転送 scp / rsync - Copy-Item (UNC) 外部コマンド -