Last Update 2014/03/11
ファイルを表示します。サイズが大きなファイルでも複数行単位の表示が可能です。
less オプション1 ファイルパス1
操作コマンド(lessのヘルプ参照)
※数値kはコマンドの前に数値を付けた際に指定される
h, H ヘルプ表示
q, :q, Q, :Q, ZZ 終了
e, ctrl-E, j, ctrl-N, CR テキストの次のk行を表示
デフォルト:1
y, ctrl-Y, k, ctrl-K, ctrl-P テキストの前のk行を表示
デフォルト:1
f, ctrl-F, ctrl-V, space テキストの次のk行を表示
デフォルト:現在のスクリーンサイズ
b, ctrl-B, esc-v テキストの前のk行を表示
デフォルト:現在のスクリーンサイズ
z テキストの次のk行を表示
デフォルト:現在のスクリーンサイズ(k値上書き)
w テキストの前のk行を表示
デフォルト:現在のスクリーンサイズ(k値上書き)
d, ctrl-D テキストの次のk行を表示
デフォルト:現在のスクリーンサイズの1/2(k値上書き)
u, ctrl-U テキストの前のk行を表示
デフォルト:現在のスクリーンサイズの1/2(k値上書き)
esc-), 右矢印キー 画面をk文字右スクロール
デフォルト:現在のスクリーンサイズの1/2(k値上書き)
esc-(, 左矢印キー 画面をk文字左スクロール
デフォルト:現在のスクリーンサイズの1/2(k値上書き)
r, ctrl-R, ctrl-L 再描画
/パターン パターンにk回目にマッチした文字列へ前方移動
デフォルト:1
?パターン パターンにk回目にマッチした文字列へ後方移動
デフォルト:1
n 前回検索したパターンでk回目にマッチした文字列へ前方移動
デフォルト:1
N 前回検索したパターンでk回目にマッチした文字列へ後方移動
デフォルト:1
esc-n 前回検索したパターンでk回目にマッチした文字列へ前方移動
(複数ファイル間可能)
デフォルト:1
esc-N 前回検索したパターンでk回目にマッチした文字列へ後方移動
(複数ファイル間可能)
デフォルト:1
esc-u 検索結果のハイライト表示をオフにする
&パターン パターンにマッチした行のみを表示
g, < ファイルのk行目に移動
デフォルト:1
G, > ファイルのk行目に移動
デフォルト:ファイルの終わり
p, % ファイルのkパーセントの位置へ移動
デフォルト:0
:e ファイルのリストへの新しいファイルの読み込み
:n k個先のファイルに移動
デフォルト:1
:p k個前のファイルに移動
デフォルト:1
:x 最初のファイルに移動
:d ファイルのリストから現在のファイルを削除
= 現在のファイルについての情報の表示
:f 現在のファイル名と行数を表示
- 続けて入力したオプション文字に対応するオプションの
設定を変更し、変更内容の情報を表示
_(下線) 続けて入力したオプション文字に対応するオプションの
設定内容の表示
v 現在行でエディタ起動
デフォルト:vi
※ オプションなどは個人的に重要と考えられるものを記述しており、記載の無いものは、manページや関連書籍などを参照願います。
※ 実行例の記述は、不要と考えられる部分の削除などの修正を行ったものを掲載しています。
※ 実行例の実行環境はFreeBSD 9.1です。
※ 実行例の記述は、不要と考えられる部分の削除などの修正を行ったものを掲載しています。
※ 実行例の実行環境はFreeBSD 9.1です。
(例) オプション無し
$ less /usr/include/stdio.h
実行結果(10行表示の場合)
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Chris Torek.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
/usr/include/stdio.h
$ less -5 /usr/include/stdio.h
実行結果(上記コマンド入力直後、10行表示の場合)
$ less -5 /usr/include/stdio.h ← この行は画面外
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Chris Torek.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
/usr/include/stdio.h
実行結果(引き続きspace入力)
* Chris Torek.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met: ← この行以降が新たな表示部分
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
:
$ less -?
実行結果(lessのヘルプが表示される)
SUMMARY OF LESS COMMANDS
Commands marked with * may be preceded by a number, N.
Notes in parentheses indicate the behavior if N is given.
h H Display this help.
q :q Q :Q ZZ Exit.
---------------------------------------------------------------------------
MOVING
e ^E j ^N CR * Forward one line (or N lines).
y ^Y k ^K ^P * Backward one line (or N lines).
f ^F ^V SPACE * Forward one window (or N lines).
b ^B ESC-v * Backward one window (or N lines).
z * Forward one window (and set window to N).
w * Backward one window (and set window to N).
ESC-SPACE * Forward one window, but don't stop at end-of-file.
HELP -- Press RETURN for more, or q when done
$ less -g /usr/include/stdio.h
実行結果(/typedef で検索)
typedef __off_t fpos_t; ← 検索結果をハイライト表示
#ifndef _SIZE_T_DECLARED
typedef __size_t size_t;
#define _SIZE_T_DECLARED
#endif
#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809
#ifndef _OFF_T_DECLARED
:
$ less -i -g /usr/include/stdio.h
実行結果(/freebsd で検索)
* $FreeBSD: release/9.1.0/include/stdio.h 235785 2012-05-22 14:40:39Z theraven $
*/
#ifndef _STDIO_H_
#define _STDIO_H_
#include
#include
:
実行結果(/Freebsd で検索)
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Chris Torek.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Pattern not found (press RETURN)
$ less -I -g /usr/include/stdio.h
実行結果(/Freebsd で検索)
* $FreeBSD: release/9.1.0/include/stdio.h 235785 2012-05-22 14:40:39Z theraven $
*/
#ifndef _STDIO_H_
#define _STDIO_H_
#include <sys/cdefs.h>
#include <sys/_null.h>
:
$ less -g -j5 /usr/include/stdio.h
実行結果(/typedef で検索)
#include <sys/cdefs.h>
#include <sys/_null.h>
#include <sys/_types.h>
typedef __off_t fpos_t;
#ifndef _SIZE_T_DECLARED
typedef __size_t size_t;
#define _SIZE_T_DECLARED
:
$ less -w /usr/include/stdio.h
実行結果(spaceで次ページ移動直後)
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
:
$ less -W /usr/include/stdio.h
実行結果(コマンド5eで5行移動直後)
* Chris Torek.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
: