less のオプション
よく使う less のオプションをメモ。
行番号の表示、長い行は折りたたまない、ファイルの末尾まで到達したら終了。
less -NeS <file>
オプションの説明
-N or --LINE-NUMBERS
Causes a line number to be displayed at the beginning of each line in the display.
-e or --quit-at-eof
Causes less to automatically exit the second time it reaches end-of-file. By default, the only way to exit less is via the "q" command.
-S or --chop-long-lines
Causes lines longer than the screen width to be chopped rather than folded. That is, the portion of a long line that does not fit in the screen width is not shown. The default is to fold long lines;
that is, display the remainder on the next line.
環境変数 $LESS をつかう
毎回タイプするのは面倒くさいので環境変数 $LESS にオプションを設定してデフォルトの振る舞いを変更できます。man をみましょう。
LESS Options which are passed to less automatically.
さっきの例だとこれでよし。
export LESS="-NeS"
おまけ
ちな、less でファイルを開いている時に F
(Shift + f, 大文字のF)をタイプすると tail -f
みたいなモードに移行するのはもう語り尽くされたね。
レス!ネス!
捗れ〜。