Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37866157
en ru br
Репозитории ALT
S:633-alt1
5.1: 436-alt2
4.1: 418-alt1
4.0: 394-alt1
3.0: 382-alt2
www.altlinux.org/Changes

Группа :: Работа с файлами
Пакет: less

 Главная   Изменения   Спек   Патчи   Исходники   Загрузить   Gear   Bugs and FR  Repocop 

<HTML>
<HEAD>
<TITLE>LESS</TITLE>
</HEAD>

<BODY>

<HR>
<CENTER>
<H1>The LESS Home Page</H1>
</CENTER>
<HR>

<H1>Welcome to the less home page!</H1>
<P>
This is the official home page for information about
the pager <STRONG>less</STRONG>.
Less was written by
Mark Nudelman (<A HREF="mailto:marknu@flash.net">marknu@flash.net</A>).
</P>

<!-- ------------------------------------------------------------------ -->
<A NAME="news">
<HR>
<H1>News</H1>

<P>
less-340 was released on 27 Apr 1999.
</P>

<UL>
<LI>Latest version (version 340)
<UL>
<LI>
<A HREF="news.340.html">Information about less-340</A>
<LI>
<A HREF="bugs.340.html">Known bugs in less-340</A>
</UL>
<LI><A HREF="old.html">Older versions</A>
</UL>
<P>
You can <A HREF="download.html">download a copy of less</A> from here.
</P>

<P>
This page was last updated on 5 Jun 1999.
</P>
<P>
This page has been viewed
3086
times since 4 April 1999.
</P>

<!-- ------------------------------------------------------------------ -->
<A NAME="faq">
<HR>
<H1>Frequently Asked Questions about less</H1>

<H2>Table of Contents</H2>

<OL>
<LI>Overview
<OL>
<LI><A HREF="#what">What is less?</A>
<LI><A HREF="#why">Why would I want to use less?</A>
<LI><A HREF="#history">Where did less come from?</A>
</OL>

<LI>Resources
<OL>
<LI><A HREF="#getit">How can I get a copy of less?</A>
<LI><A HREF="#nextver">When is the next version of less going to be released?</A>
<LI><A HREF="#mail">How can I write to the author of less?</A>
</OL>

<LI>Technical questions
<OL>
<LI><A HREF="#y2k">Is less Y2K compliant?</A>
<LI><A HREF="#tricks">Cool less tricks</A>
<LI><A HREF="#build">I can't get less to build!</A>
<LI><A HREF="#unix">Do I need Unix to use less?</A>
<LI><A HREF="#intl">Can less display non-English language characters?</A>
<LI><A HREF="#wrap">Why does less scroll off the screen if there are long lines?</A>
<LI><A HREF="#dashr">Why does -r cause display problems?</A>
<LI><A HREF="#tite">Can less leave the screen alone when it quits?</A>
<LI><A HREF="#dashe">Why doesn't less quit when it reaches the end of the file?</A>
<LI><A HREF="#csh">Why does it take so long to start the editor / start a shell?</A>
<LI><A HREF="#csh2">Why does it say
"<CODE>stty: TCGETS: Operation not supported on socket</CODE>"?</A>
<LI><A HREF="#filter">Can less view compressed files?</A>
<LI><A HREF="#version">Why are there no dots in the version number?</A>
<LI><A HREF="#bugs">What if I find a bug in less?</A>
</OL>
</OL>

This FAQ is Copyright &copy;1999 by Mark Nudelman.
This document may be reproduced, so long as it is kept
in its entirety and in its original format.

<HR>

<H2>Questions and Answers</H2>

<!-- ------------------------------------------------------------------ -->
<A NAME="what">
<H3>What is less?</H3>
<P>
Less is a pager.
A pager is a program that displays text files.
Other pagers commonly in use are <CODE>more</CODE> and <CODE>pg</CODE>.
Pagers are often used in command-line oriented systems like
Unix and MS-DOS to display files.
Windowing systems like Windows and the Macintosh don't need
pagers as much, since they have other methods for viewing files.
</P>
<P>
Less is not an editor.
You can't change the contents of the file you're viewing.
Less is not a windowing system.
It doesn't have fancy scroll bars or other
GUI (graphical user interface) elements.
It was designed to work on simple text-only terminals.
</P>
<P>
Less has been used by thousands of people around the world since its
release in 1985.
</P>

<!-- ------------------------------------------------------------------ -->
<A NAME="why">
<H3>Why would I want to use less?</H3></A>
<P>
If you're not using a pager now, then you probably don't need less.
But if you're using another pager, you should take a look at less.
Less has some very nice features:
</P>

<DL>
<DT>Backwards movement
<DD>It's hard to believe some people are still using pagers
that don't let you move backwards in the file.
Even pagers that do let you move backwards often don't work
when viewing "standard input"; that is, data that is being
piped into the pager from another program.

<DT>Searching and highlighting
<DD>Less lets you search for text in the file you're viewing.
You can search forwards and backwards.
Furthermore, less highlights the text that matches your search,
to make it easy to see where the match is.

<DT>Multiple files
<DD>Less allows you to switch between any number of different
files, remembering your position in each file.
You can also do a single search which spans all the files you are working with.

<DT>Bold and underline
<DD>Some text files, notably Unix-style "man pages",
use overstriking (backspaces) to simulate underlined and bold text.
Less interprets this overstriking and displays the text in real
underlined or bold mode.

<DT>Advanced features
<DD>Less has a large number of fancy features for advanced users.
Once you learn the basics, you'll find you can customize less to
do almost anything you want it to do.
You can change key bindings, set different tab stops,
set up filters to view compressed data or other file types,
customize the prompt, display line numbers, use "tag" files, and more.

<DT>Portability
<DD>Less is available on many different machines, different
system architectures, and different terminals.
Pretty much wherever you go, you'll find less.
You won't have to learn how to use a different pager on every system you use.
</DL>

<!-- ------------------------------------------------------------------ -->
<A NAME="history">
<H3>Where did less come from?</H3>
<P>
Back in 1983, I was working for a now-defunct company
called Integrated Office Systems.
Some of our software ran on a Unix system and produced enormous log files
of its transactions.
We wanted to be able to search these log files for error messages.
But the version of "vi" we were using couldn't handle files larger than
a certain size, and our log files often exceeded that size.
So we were forced to use "more" to view the files.
The problem was, once we found an error message, what we really wanted
to see was the transactions leading up to the error; that is,
the lines in the log file immediately before the error message.
But more didn't allow backward movement in the file.
</P>
<P>
We often complained about this problem.
We said we needed a "backwards more"; someone (it wasn't me,
but unfortunately I don't remember who it was) coined the name "less"
as a joke on the concept of a "backwards more".
It didn't seem to me that
it would be too difficult to write a simple pager that would allow
forward and backward movement.
I wrote the first version in late 1983 and we began using it internally.
I continued to enhance it and finally decided it was a useful enough
tool that I should make it available to the world.
I posted the first version to the newsgroup called (at that time)
<CODE>net.sources</CODE> in May, 1985.
</P>
<P>
Making the program publicly available allowed an enormous number
of people to use it.
Many people have made their own modifications and donated them
to me for incorporation into the official version, and
many more have reported bugs they've found or
made suggestions about features they'd like to see added.
This was my first experience with the concept of what is now
called "open source" or "free software",
and it has, I believe, produced a very high quality product.
I'd like to thank all the users of less for their invaluable comments
and suggestions over the years.
Less wouldn't be what it is today without you.
</P>

<!-- ------------------------------------------------------------------ -->
<A NAME="getit">
<H3>How can I get a copy of less?</H3>
<P>
You can <A HREF="download.html">download</A> a copy of less from here.
</P>
<P>
Less is also distributed as a part of the standard software available
with many varieties of Unix and similar systems.
Less is also available from many ftp sites, including the GNU archives
on <A HREF="ftp://ftp.gnu.org/gnu/less">ftp.gnu.org/gnu/less</A>.
</P>

<!-- ------------------------------------------------------------------ -->
<A NAME="nextver">
<H3>When is the next version of less going to be released?</H3>
<P>
Version 335 was released on 3 Apr 1999 and version 340
was released on 27 Apr 1999.
Any bugs found in this version will be fixed as soon as possible.
There are as yet no plans for another release.
</P>

<!-- ------------------------------------------------------------------ -->
<A NAME="mail">
<H3>How can I write to the author of less?</H3>
<P>
Less was written by Mark Nudelman
and is currently being maintained by him.
You can write to him at <A HREF="mailto:marknu@flash.net">marknu@flash.net</A>.
</P>

<!-- ------------------------------------------------------------------ -->
<A NAME="y2k">
<H3>Is less Y2K compliant?</H3>
<P>
Neither less nor lesskey use dates in any way, so there
should be no Y2K issues with either program.
However, no extensive testing has been done to verify this.
</P>
<P>
There are some ways that Y2K problems in other programs
could affect the operation of less.
For example, Unix versions of less use the shell to perform file name
expansion. So if the shell you are using has Y2K bugs, it could cause
less to fail to expand filenames correctly.
Similarly, if you are using a LESSOPEN program which has Y2K bugs,
it could affect the operation of less.
</P>

<!-- ------------------------------------------------------------------ -->
<A NAME="tricks">
<H3>Cool less tricks</H3>
<P>
New users of less sometimes find that less doesn't behave exactly the
way they expect.
If this is the case, don't despair.
Less has an enormous number of options (perhaps too many)
which let you change the way it behaves.
Chances are, there is a way to make less do what you want.
A complete description of all these features is in the less man page,
but here's a summary of some of the more popular ones.
</P>
<DL>
<DT>Quit at end-of-file
<DD>To make less automatically quit as soon as it reaches the end of the file
(so you don't have to hit "q"), set the -E option.
<DT>Verbose prompt
<DD>To see a more verbose prompt, set the -m or -M option.
You can also design your own prompt; see the man page for details.
<DT>Clear the whole screen
<DD>To make less clear and repaint the screen rather than scrolling
when you move to a new page of text, set the -C option.
<DT>Case-less searches
<DD>To treat upper-case and lower-case letters the same in searches,
set the -I option.
<DT>Start at a specific place in the file
<DD>To start at a specific line number, say line 150,
use "<CODE>less +150 filename</CODE>".
To start where a specific pattern first appears,
use "<CODE>less +/pattern filename</CODE>".
To start at the end of the file, use "<CODE>less +G filename</CODE>".
<DT>Scan all instances of a pattern in a set of files
<DD>To search multiple files, use "<CODE>/*pattern</CODE>"
instead of just "<CODE>/pattern</CODE>".
To do this from the command line, use "<CODE>less '+/*pattern' ...</CODE>".
Note that you may need to quote the "<CODE>+/*pattern</CODE>" argument
to prevent your shell from interpreting the "<CODE>*</CODE>".
<DT>Watch a growing file
<DD>Use the F command to go to the end of the file and keep
displaying more text as the file grows.
You can do this from the command line by using "<CODE>less +F ...</CODE>".
<DT>Change keys
<DD>The <CODE>lesskey</CODE> program lets you change the meaning
of any key or sequence of keys. See the lesskey man page for details.
<DT>Save your favorite options
<DD>If you want certain options to be in effect whenever you run less,
without needing to type them in every time,
just set your "<CODE>LESS</CODE>" environment variable to the options you want.
(If you don't know how to set an environment variable,
consult the documentation for your system or your shell.)
For example, if your <CODE>LESS</CODE> environment variable
is set to "<CODE>-IE</CODE>", every time you run less
it will do case-less searches and quit at end-of-file.
</DL>

<!-- ------------------------------------------------------------------ -->
<A NAME="build">
<H3>I can't get less to build!</H3>
<P>
There are a number of possible reasons why less
may not be building on your system.
If you're building on a Unix system, and you ran "sh configure" once,
you might try removing the "config.log" and "config.cache" files and
trying it all from scratch again; that is, run "sh configure" again.
</P>
<P>
If that doesn't help and you're still stumped, send
<A HREF="#mail">email to the author</A> describing your problem.
If possible, include the messages produced by the configure
and/or make procedures.
</P>

<!-- ------------------------------------------------------------------ -->
<A NAME="unix">
<H3>Do I need Unix to use less?</H3>
<P>
Less was originally developed for Unix, but has been ported
to a variety of other systems, including MS-DOS, Windows, OS/2, and OS-9.
See the <A HREF="download.html">download</A> page for a
list of supported systems.
</P>

<!-- ------------------------------------------------------------------ -->
<A NAME="intl">
<H3>Can less display non-English language characters?</H3>
<P>
Less can display non-English characters as long as each character
is one byte long.
To use a non-ASCII single-byte character set, you need to set up
your system with the correct "locale" settings.
If your system does not support setlocale, you can set the
<CODE>LESSCHARSET</CODE> or <CODE>LESSCHARDEF</CODE>
environment variable to tell less what language you are using.
See the section "NATIONAL CHARACTER SETS" in the man page for details.
</P>
<P>
The standard version of less doesn't work for languages such as
Japanese and Chinese, which require more than one byte per character.
There is a modified version called "cless" which is supposed to work
with Chinese, but I haven't used it and I'm not sure where to get the
latest version.
There are also several versions modified to work with Japanese,
but again, I haven't used them.
One such Japanese version is available as a patch to less-330, at
<A HREF="http://www.io.com/~kazushi/less">http://www.io.com/~kazushi/less</A>.
</P>

<!-- ------------------------------------------------------------------ -->
<A NAME="wrap">
<H3>Why does less scroll off the screen if there are long lines?</H3>
<P>
If you see data scroll off the screen when you view lines longer
than the screen width, something is wrong.
There are two likely possibilities.
First, you may be using the -r option (either explicitly or in
your LESS environment variable).
The man page states that the -r option may cause display problems
(see <A HREF="#dashr">Why does -r cause display problems?</A> for more details).
The other possibility is more difficult to diagnose: you may have
a mismatch between your termcap setup and the type of your terminal.
On most systems, you should check that:
<UL>
<LI>your TERM environment variable matches the type of terminal you are using.
<LI>the environment variables LINES and COLUMNS are correct
for your terminal (if they are set).
<LI>"stty rows" and "stty columns" are correct for your terminal
(if they are non-zero).
</UL>
</P>

<!-- ------------------------------------------------------------------ -->
<A NAME="dashr">
<H3>Why does -r cause display problems?</H3>
<P>
Less needs to keep track of where the cursor is
on the screen as it displays text, so that it knows when it reaches the
end of the line.
If the screen is 24 lines high, less wants to display
enough text to exactly fill those 24 lines.
To do this, it needs to know
when it reaches the end of a line on the screen.
But if it just starts outputting raw control characters (like ESC),
it won't be able to keep track of this.
For example, if less outputs four ordinary characters, it
moves the cursor four spaces to the right.
But on a vt220 terminal, if less outputs
the four characters "ESC [ 1 m", it merely switches the terminal to
"bold", but doesn't move the cursor.
On the other hand, if it outputs "ESC [ 1 H",
it moves the cursor to the top left corner of the screen!
Obviously less would need to know what every escape sequence does
to the particular terminal being used, which is not practical.
So by default less does not output ESC or other control characters,
to avoid this problem.
When -r is set, it does output control characters, but then
it is no longer possible to determine when the text wraps to
a new line on the display,
so the display may not be accurate in all cases.
</P>

<!-- ------------------------------------------------------------------ -->
<A NAME="tite">
<H3>Can less leave the screen alone when it quits?</H3>
<P>
When less quits, it sends the "te" termcap string to the terminal.
Exactly what that does depends on the system you are using, the
type of terminal, and your version of termcap.
On some systems, it does nothing; on others it restores the screen
to the state it was in when less started, thus erasing from the screen
the last page of the file which less was viewing.
If you don't like the behavior of "te" on your system,
you can disable the sending of the "te" string by invoking less
with the -X option.
If you want "te" to do something different (for example, restore
the screen if it's not doing that already), you'll have to figure
out how to override the default termcap on your system.
Unfortunately, this is done differently on different systems,
so you'll have to check the documentation for your system.
</P>

<!-- ------------------------------------------------------------------ -->
<A NAME="dashe">
<H3>Why doesn't less quit when it reaches the end of the file?</H3>
<P>
Normally, less doesn't quit until you type "q".
You can make it quit as soon as it reaches the end of the file
by using the -E option.
However, many (but not all) people prefer to have less remain active until
they explicitly quit, because they might wish to back up and look
at earlier parts of the file again.
</P>

<!-- ------------------------------------------------------------------ -->
<A NAME="csh">
<H3>Why does it take so long to start the editor / start a shell?</H3>
<P>
If you use csh, you may find it takes a long time to start a shell
(using the "!" command) or to start an editor (using the "v" command).
This is usually because your .cshrc file contains many commands.
Csh executes the commands in .cshrc each time less starts a subshell.
If you only need these commands executed once at login, and not
in every subshell, you can move them to .login instead of .cshrc.
Changing your SHELL environment variable to "sh" can also avoid
this problem, although you will then be using sh rather than csh
in programs that use the SHELL variable.
You can also try setting SHELL to "csh -f", which tells
csh not to execute the .cshrc or .login files.
</P>

<!-- ------------------------------------------------------------------ -->
<A NAME="csh2">
<H3>Why does it say
"<CODE>stty: TCGETS: Operation not supported on socket</CODE>"?</H3>
<P>
If you see this message and you're using csh, you probably have
a "<CODE>stty</CODE>" command in your .cshrc file.
You should either move this to your .login file so it only gets
executed once, when you login;
or set your SHELL variable to "csh -f", which tells
csh not to execute the .cshrc or .login files.
</P>

<!-- ------------------------------------------------------------------ -->
<A NAME="filter">
<H3>Can less view compressed files?</H3>
<P>
Less provides a mechanism to <I>preprocess</I> the file being viewed.
The preprocessing can decompress a compressed file, or do other
arbitrary processing on the file contents.
However, each user must specify their own preprocessor.
See the INPUT PREPROCESSOR section of the man page for more details.
Less does not provide any default preprocessing, because the types
of compressed files likely to be viewed depends on the
work habits of the particular user.
In a future release of less, some automatic preprocessing may be provided.
</P>

<!-- ------------------------------------------------------------------ -->
<A NAME="version">
<H3>Why are there no dots in the version number?</H3>
<P>
I use a very simple version numbering scheme.
The first version of less was version 1.
The next was version 2. And so on.
There are no "major" and "minor" releases, so there
are no dots in the version number.
So version 340 is the three hundred and fortieth version of less.
It's just 340, not 3.40 or 3.4.0.
</P>

<!-- ------------------------------------------------------------------ -->
<A NAME="bugs">
<H3>What if I find a bug in less?</H3>
<P>
If you find a bug in less,
please send <A HREF="#mail">email to the author</A>.
Describe the bug in as much detail as possible,
and I'll do what I can to help resolve the problem.
</P>

</BODY>
</HTML>
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin