始終對 grep 指令的輸出進行著色

始終對 grep 指令的輸出進行著色

我幾乎只使用帶有 -nr 選項和 --color 的 grep

我可以在我的 Linux 環境中設定一些東西來預設使用它嗎?

答案1

將其添加到您的 ~/.bashrc 中:

alias grep='grep -nr --color'

並取得 ~/.bashrc 或使用第二個 shell 登入:

source ~/.bashrc

相關內容