HOME

TheInfoList



OR:

less is a
terminal pager A terminal pager, paging program or simply pager is a computer program used to view (but not modify) the contents of a text file moving down the file one line or one screen at a time. Some, but not all, pagers allow movement up a file. A popul ...
program Program, programme, programmer, or programming may refer to: Business and management * Program management, the process of managing several related projects * Time management * Program, a part of planning Arts and entertainment Audio * Progra ...
on
Unix Unix (; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, and ot ...
,
Windows Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for serv ...
, and
Unix-like A Unix-like (sometimes referred to as UN*X or *nix) operating system is one that behaves in a manner similar to a Unix system, although not necessarily conforming to or being certified to any version of the Single UNIX Specification. A Unix-li ...
systems used to view (but not change) the contents of a
text file A text file (sometimes spelled textfile; an old alternative name is flatfile) is a kind of computer file that is structured as a sequence of lines of electronic text. A text file exists stored as data within a computer file system. In operating ...
one screen at a time. It is similar to , but has the extended capability of allowing both forward and backward navigation through the file. Unlike most Unix text editors/viewers, does not need to read the entire file before starting, allowing for immediate viewing regardless of file size.


History

Mark Nudelman initially wrote less during 1983–85, in the need of a version of
more More or Mores may refer to: Computing * MORE (application), outline software for Mac OS * more (command), a shell command * MORE protocol, a routing protocol * Missouri Research and Education Network Music Albums * ''More!'' (album), by Booka S ...
able to do backward scrolling of the displayed text. The name came from the joke of doing "backwards more." Originally, less was developed for Unix, but it has been ported to a number of other operating systems, including
MS-DOS MS-DOS ( ; acronym for Microsoft Disk Operating System, also known as Microsoft DOS) is an operating system for x86-based personal computers mostly developed by Microsoft. Collectively, MS-DOS, its rebranding as IBM PC DOS, and a few ope ...
,
Microsoft Windows Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for serv ...
,
OS/2 OS/2 (Operating System/2) is a series of computer operating systems, initially created by Microsoft and IBM under the leadership of IBM software designer Ed Iacobucci. As a result of a feud between the two companies over how to position OS/2 ...
, and
OS-9 OS-9 is a family of real-time, process-based, multitasking, multi-user operating systems, developed in the 1980s, originally by Microware Systems Corporation for the Motorola 6809 microprocessor. It was purchased by Radisys Corp in 2001, and ...
, as well as
Unix-like A Unix-like (sometimes referred to as UN*X or *nix) operating system is one that behaves in a manner similar to a Unix system, although not necessarily conforming to or being certified to any version of the Single UNIX Specification. A Unix-li ...
systems such as
Linux Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, which ...
. It is still maintained today by Nudelman. To help remember the difference between less and more, a common joke is to say, "," implying that less has greater functionality than . A similar saying is that "less is more, more or less".


Usage

can be invoked with options to change its behaviour, for example, the number of lines to display on the screen. A few options vary depending on the operating system. While is displaying the file, various commands can be used to navigate through the file. These commands are based on those used by both and . It is also possible to search for character patterns in the file. By default, displays the contents of the file to the
standard output In computer programming, standard streams are interconnected input and output communication channels between a computer program and its environment when it begins execution. The three input/output (I/O) connections are called standard input (stdin ...
(one screen at a time). If the file name argument is omitted, it displays the contents from
standard input In computer programming, standard streams are interconnected input and output communication channels between a computer program and its environment when it begins execution. The three input/output (I/O) connections are called standard input (stdin ...
(usually the output of another command through a
pipe Pipe(s), PIPE(S) or piping may refer to: Objects * Pipe (fluid conveyance), a hollow cylinder following certain dimension rules ** Piping, the use of pipes in industry * Smoking pipe ** Tobacco pipe * Half-pipe and quarter pipe, semi-circula ...
). If the output is redirected to anything other than a
terminal Terminal may refer to: Computing Hardware * Terminal (electronics), a device for joining electrical circuits together * Terminal (telecommunication), a device communicating over a line * Computer terminal, a set of primary input and output dev ...
, for example a pipe to another command, behaves like . The "lesspipe" extension can automatically determine file types such as
PDF Portable Document Format (PDF), standardized as ISO 32000, is a file format developed by Adobe in 1992 to present documents, including text formatting and images, in a manner independent of application software, hardware, and operating systems. ...
, multimedia, and
compressed archive In computing, an archive file is a computer file that is composed of one or more files along with metadata. Archive files are used to collect multiple data files together into a single file for easier portability and storage, or simply to compres ...
s, and automatically determines which program to launch display the file's information with, such as text from a PDF file, metadata of photos, lists of files in a compressed archive, and content of a single file in a compressed archive. The command-
syntax In linguistics, syntax () is the study of how words and morphemes combine to form larger units such as phrases and sentences. Central concerns of syntax include word order, grammatical relations, hierarchical sentence structure ( constituency) ...
is: less ptions
ile_name Ile may refer to: * iLe, a Puerto Rican singer * Ile District (disambiguation), multiple places * Ilé-Ifẹ̀, an ancient Yoruba city in south-western Nigeria * Interlingue (ISO 639:ile), a planned language * Isoleucine, an amino acid * Another n ...
..


Frequently used options

*-g: Highlight just the current match of any searched string. *-i: Search case-insensitively. *-m: Show more detailed prompt, including file position. *-N: Show line numbers (useful for viewing
source code In computing, source code, or simply code, is any collection of code, with or without comments, written using a human-readable programming language, usually as plain text. The source code of a program is specially designed to facilitate the wo ...
). *-x3: Set tabstops (the number of columns per hard tab character) to the specified number (3, in this example) (useful for viewing
source code In computing, source code, or simply code, is any collection of code, with or without comments, written using a human-readable programming language, usually as plain text. The source code of a program is specially designed to facilitate the wo ...
). *-S: Disable line wrapping ("chop long lines"). Long lines can be seen by side-scrolling. *-X: Leave file contents on screen when less exits. *-?: Show help. *--follow-name: Follow mode, for log files that get replaced while being viewed.


Frequently used commands


Examples

less -M readme.txt # Read "readme.txt" less +F /var/log/mail.log # Follow mode for log file * , less # Easier file analysis less -I -p void *.c # Case insensitive search for "void" in all .c files


Memory considerations

The --buffers=n and --auto-buffers options control how much memory less may use to buffer inputs. This is most relevant when less is directly accessing a named file that is modified or deleted while less is still running, and when less is receiving data from a pipe and the data can not be randomly accessed or regenerated. On the other hand, unlimited buffering means that less will request as much memory as it is fed data, which could drive the system into using virtual memory and swapping a lot of data between RAM and disks (dramatically slowing system performance for most applications on the host), or even further into memory exhaustion where any application on the host requesting memory may have that request denied, or may crash when attempting to access memory that the OS promised but can't find when the application actually attempts to use it and a page-fault occurs. For this reason, some companies/organisations insist that less be used only with fixed buffering - or not at all - on production machines.


See also

*
more (command) In computing, more is a command to view (but not modify) the contents of a text file one screen at a time. It is available on Unix and Unix-like systems, DOS, Digital Research FlexOS, IBM/Toshiba 4690 OS, IBM OS/2, Microsoft Windows and ReactOS ...
*
most (Unix) most is a terminal pager program on Unix, OpenVMS, MS-DOS, Windows and Unix-like systems used to view (but not change) the contents of a text file one screen at a time. Programs of this sort are called ''pagers''. It is similar to more, but has t ...
*
pg (Unix) pg is a terminal pager program on Unix and Unix-like systems for viewing text files. It can also be used to page through the output of a command via a pipe. pg uses an interface similar to vi, but commands are different. As of 2018, pg has be ...


References


External links

*
Manual page
{{Unix commands GNU Project software Terminal pagers