Like what you see? Get it in one document for easy printing!
Click Here!

Custom Search







Table Of Contents  CertiGuide to A+ (A+ 4 Real)
 9  Chapter 5: The Linux Operating System
      9  Basic Concepts and Procedures for Creating, Viewing and Editing Files and Directories
           9  Common Commands

Previous Topic/Section
cat - Concatenate Files And Print To The Standard Output
Previous Page
Pages in Current Topic/Section
1
Next Page
head, tail - Output the First or Last Part of a File to the Screen
Next Topic/Section

more, less - Peruse A File One Screen at a Time

There are two command line file viewers in Linux called more and less. More was the original file viewer written for UNIX, which had limited ability to move forwards and backwards through a file. Less, its younger brother was written to be an enhancement to more expanding the feature set and giving it additional functionality. Although many enhancements have been written for both utilities, even today less still has more capability then more. They can be invoked by:

more [options] file_name

less [options] file_name

This displays the beginning of the file on the screen. The next table lists a basic set of commands for more and less. Notice that more does not support use of the arrow keys to move forward to a backward in a file where as less supports this additional functionality. The f key will move forward through the file one page at a time, the return or enter key will move forward one line at a time and the enter key will move forward through the file one line at a time. The b key will move backwards through the file one page at a time.

Table 12 provides a summary of the keys used by more/less and what they do.


Table 12: more/less Keys Commands

Function Group

Key

Command

General

h, H

Display help.

q, Q, ZZ

Exit.

Moving

DownArrow, j, CR

Forward one line (or N lines).

 

UpArrow, k

Backward one line (or N lines).

f, ^F, SPACE

Forward one window (or N lines).

b, ^B

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-(, RightArrow

Left 8 character positions (or N positions).

ESC-), LeftArrow

Right 8 character positions (or N positions).

Searching

/pattern

Search forward for (N-th) matching line.

?pattern

Search backward for (N-th) matching line.

n

Repeat previous search (for N-th occurrence).

N

Repeat previous search in reverse direction.

Jumping

g, < , ESC-<

Go to first line in file (or line N).

G, > , ESC->

Go to last line in file (or line N).

p, %

Go to beginning of file (or N percent into file).

v

Edit the current file with vi

V

Print version number of "less".


Previous Topic/Section
cat - Concatenate Files And Print To The Standard Output
Previous Page
Pages in Current Topic/Section
1
Next Page
head, tail - Output the First or Last Part of a File to the Screen
Next Topic/Section

If you find CertiGuide.com useful, please consider making a small Paypal donation to help the site, using one of the buttons below. You can also donate a custom amount using the far right button (not less than $1 please, or PayPal gets most/all of your money!) In lieu of a larger donation, you may wish to consider buying an inexpensive PDF equivalent of the CertiGuide to A+ (A+ 4 Real) from StudyExam4Less.com. Thanks for your support!
Donate $2
Donate $5
Donate $10
Donate $20
Donate $30
Donate: $



Home - Table Of Contents - Contact Us

CertiGuide to A+ (A+ 4 Real) (http://www.CertiGuide.com/apfr/) on CertiGuide.com
Version 1.0 - Version Date: March 29, 2005

Adapted with permission from a work created by Tcat Houser et al.
CertiGuide.com Version Copyright 2005 Charles M. Kozierok. All Rights Reserved.
Not responsible for any loss resulting from the use of this site.