LoginSignup
0
2

More than 5 years have passed since last update.

【CentOS】grep検索で行数も表示する

Posted at

grep検索を行う際、行数も表示して欲しいので、
毎回-n オプションを使用していたのですが、毎回打つのは案外面倒です。

ということで、.bashrcにaliasを登録しておきます。

以下コマンドにて登録
$ echo "alias grep='grep -n'" >> ~/.bashrc

登録後、設定を反映
$ . ~/.bashrc

上記を行っておけば、
以降、-nをつけなくても行数も表示してくれるようになります。

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