1, more command
In Linux, more command is a vi editor text filter, which can display the contents of a text file by page in full-screen mode, more built inside some shortcuts.
(1) command syntax
More (option) (parameters)
(2) common options
- <number>: Number of lines per screen display;
-d: Display "[Press space to continue, 'q' to quit.]";
-c: without scrolling operation, each time the screen is refreshed;
-u: Turn underline;
+ <Number>: start display file contents from the specified number of rows.
(3) parameters
File: Specifies the page display file contents.
(4) Examples
From the start Line 10 displays the contents of globalmem.c document:
$ more -dc +10 globalmem.c
(5) Shortcuts
Enter: n rows down, their need to define the number of rows, the default is one line;
Ctrl + F: scroll down a screen;
Spacebar: scroll down a screen;
Ctrl + B: Returns to the previous screen;
=: Number of output lines of the current line;
: F: output file name and line number of the current line;
V: invokes the vi editor;
!: Calling Shell and execute the command;
q: Quit more command.
2, less command
In Linux, the command less similar to the more command, but less command allows the user to browse the file forward or backward, but more command only allows the user to browse forward.
(1) command syntax
less (Option) (parameters)
(2) Option
-e: documents show that after completion, automatically exit;
-f: Force display the file;
-g: do not highlight any keyword to search, display only the currently displayed keywords, improve the display speed;
-l: Ignore differences sensitive search;
-N: each trekking first display line numbers;
-s: a plurality of consecutive blank lines into one line display;
-S: content show longer on a single line, not shown with a line;
-x <number>: Tab characters will appear as a space specified number of characters.
(3) parameters
File: Specify the split-screen display file contents.
(4) Examples
Use the less command to view globalmem.c file, and file search "globalmem" Keywords:
$ less globalmem.c
(5) Shortcuts
PageUp: page up;
PageDown: Down;
q: exit the less command.
3, tail command
In Linux, tail tail command is used to output the contents of a file, the default display 10 lines at the end of the specified file on the screen when multiple files are not given, then display the file name of each file preceded by the title .
(1) command syntax
tail (Option) (parameters)
(2) Option
-f: loop reads the file;
-q: does not display information;
-v: display detailed processing information;
-c <number>: number of bytes displayed;
-n <line number>: displays the file contents tail n lines;
-pid = PID: in combination with the -f, it indicates the end of the process after the PID die;
-q: no output headers giving file names;
-s <number>: -f combination with, the sleep interval represents a repeating number per second.
(3) parameters
File list: Specifies the list of files to display the contents of the tail.
(4) Examples
The last line shows the document file of 10:
$ tail filename
File display file contents, from line 20 to the end of the file:
$ tail +20 filename
Display file file of the last 10 characters:
$ tail -c 10 filename
Display multiple files:
$ tail globalmem.c Makefile
reference:
https://man.linuxde.net/tail
https://man.linuxde.net/less
https://www.runoob.com/linux/linux-comm-tail.html
https://www.runoob.com/linux/linux-comm-more.html