0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

コマンドの場所を表示【BashとPowerShellの比較】

Posted at

Linux(Bash)とWindows(PowerShell)のコマンド対応表 に戻る


対応表

シェル スペル 短縮形
Bash which -
PowerShell Get-Command gcm

Bash

コマンド形式

$ which <コマンド名>

使用例

例1)lsコマンドの場所を表示

$ which ls
/usr/bin/ls

例2)pingコマンドの場所を表示

$ which ping
/usr/bin/ping

例3)sshコマンドの場所を表示

$ which ssh
/usr/bin/ssh

PowerShell

コマンド形式

> Get-Command <コマンド名>

使用例

例1)Get-ChildItemコマンドの場所を表示

> Get-Command Get-ChildItem

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Cmdlet          Get-ChildItem                                      3.1.0.0    Microsoft.PowerShell.Management

例2)pingコマンドの場所を表示

> Get-Command ping

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Application     PING.EXE                                           10.0.18... C:\WINDOWS\system32\PING.EXE

例3)sshコマンドの場所を表示

> Get-Command ssh

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Application     ssh.exe                                            7.7.2.1    C:\WINDOWS\System32\OpenSSH\ssh.exe
0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?