0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Grepメモ②

Last updated at Posted at 2025-09-08

[grep]

grepでターミナルの色が見づらいとき

  • 1行ごとに色を指定
    fn:ファイル名
    1:太字
    33:黄色(ANSIカラー)
GREP_COLORS='fn=1;33' grep --color=always 'search_word' file_name
  • bashrcに書き込み
    sourceで適用
export GREP_COLORS='mt=01;37:fn=35:ln=32:bn=36:se=01;33'
source ~/.bashrc
  • 他の指定(他は使用したことない)
    mt:マッチテキスト(検索語と一致した部分)
    fn:ファイルネーム(-Hオプションや複数ファイルを指定した場合)
    ln:ラインナンバー(-nオプションで行番号を表示した場合)
  • 色の指定(黒地の際のおすすめ)
    32:緑
    33:黄色
    36:シアン
0
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?