0

使用 PSReadLine 2.2.0 beta4

Set-PSReadLineOption -PredictionSource 历史

Set-PSReadLineOption -PredictionViewStyle ListView

powershell 可以像这样显示历史:

在此处输入图像描述

Bash 或任何其他 Linux shell 是否具有此功能?

4

1 回答 1

0

您可以使用该history命令查看之前的命令。如果要过滤,则可以使用grep命令,例如

history | grep git

你会得到例如:

  207  git push origin init-repo
  226  git status
  227  git add war/src/main/java/com/xxx/Application.java
  228  git status
  229  git fetch
  230  git checkout init-repo
  231  git stash
  232  git stash pop
  233  git add pom.xml
  234  git status
  235  git add *
  236  git add all
  237  git add-all
  238  git --help
  239  git add --all
  240  git stash
  241  git stash pop
  242  git add --all
  243  git pull
  502  history | grep git
[admin@host]$ 

于 2021-11-01T06:26:56.860 回答