1. 使用
使い方は、以下の通りです。history
の頭に cat $
がつきます。
cat $history
例えば、ある単語 foo を検索したい場合は
cat $history | grep foo
2. 設定
Step 1. $profile を開きます。
notepad $profile
Step 2. 以下の内容を追記します。
$history="C:\Users\{ユーザ名}\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt"
Set-Alias grep Select-String
Step 3. ターミナルを再起動します。
3. 補足
$profile
は sh の ~/.profile や bash の ~/.bashrc に該当するような感じです。
Set-Alias
はファイルパスには使用できなかったので、変数に代入する形にしました。
Get-Alias
で既に設定されているエイリアスを確認することもできます。