less is a terminal pager program used to view (but not change) the contents of a text file one screen at a time.

learn more… | top users | synonyms

-1
votes
0answers
30 views

Force less to deal with long lines [on hold]

less is a crap viewer when one of the lines is long. Here is a simple example: (seq 10; echo `seq 1000`; seq 10)|less How can I force less to show the long line as pretty as emacs, vi, or more? If ...
0
votes
1answer
21 views

page up and page down alternative for horizontal scrolling in less

In vertical scrolling using less the page up and page down keys are working. Which keys scrolls one page down/up vertically? The less was started with -S option.
8
votes
1answer
36 views

How to prevent HP-UX command “less” from messing up my prompt?

I don't like the output of more on HP-UX, so I use less instead as a pager: PAGER=less Its output is nice, but, on Linux, when I use man and then quit, I go back to the shell, and the display looks ...
0
votes
1answer
22 views

pager “less”: --quit-if-one-screen without --no-init

I can't get less --quit-if-one-screen (-F) working without --no-init (-X). less --quit-if-one-screen /proc/uptime I see no output. This works: less --quit-if-one-screen --no-init /proc/uptime ...
-2
votes
1answer
40 views

Go to line in less command is not working if using “+Gg” at the same time

I want to go to line 100 directly when opening a file, but I use -M and +Gg at the same time to show verbose detail in status bar. -M is for the file name and line number of the current screen +Gg ...
3
votes
1answer
23 views

Unwanted ctrl+h in file saved from man's output

After man less (and optionally hit h for "Summary of less commands"), since man uses less to display the text, I hit s to save the text to a file. When I open the file in emacs or vi, there are ...
2
votes
1answer
29 views

Is there any way to exit “less” follow mode without ^C?

Often times I find myself in need to have the output in a buffer with all the features (scrolling, searching, shortcuts, ...) and I have grown accustomed to less. However, most of the commands I use ...
3
votes
1answer
83 views

Does less have a feature like tail --follow=name (-F)

The command less can be used to replace tail in tail -f file to provide features like handling binary output and navigating the scrollback: less +F file The + prefix means "pretend I type that ...
0
votes
2answers
33 views

is it possible to open files in subdirectories with less?

I sometimes use less to quickly page through a small collection of files using something like less brscan/*/* and then I use :n to cycle through the files If I have a folder/s e.g. brscan/ ├── ...
0
votes
1answer
26 views

Interactive less search with wildcards [duplicate]

I'm using less to view a large file and I want to search for a pattern with wildcards — e.g., " x 1??" where ? is any character. Does less support that, and if so how would I do that ...
5
votes
1answer
95 views

Is `tail -f` more efficient than `less +F`?

This article pointed out some reasons to use less +F over tail -f. Most of the reasons are about the features, not technical reasons: less +F can highlight, search, navigate through file. How about ...
1
vote
2answers
43 views

How to run a long running grep, pipe the result into less and put everything into background?

I often find myself in the situation where I need to find a code base for a given symbol like so: find src/galio -not -path './src/stapi-sdk/apilib/* -regextype posix-extended -iregex ...
2
votes
1answer
37 views

How to chain multiple LESSOPEN scripts?

Linux distributions nowadays have a default LESSOPEN set to /usr/bin/lesspipe which allows one to easily inspect e.g. zipped files or PDF files. Now I wanted to see whether I can add syntax ...
3
votes
2answers
55 views

less: /pattern search starts at first line

Consider the following file: $ LESS= \less test abc def abc By default, searching /abc in less will jump to line 3 since /pattern search starts at second line according to man 1 less: /pattern ...
1
vote
3answers
36 views

xargs git: skip user input

I have an xargs function that calls git commands recursively. When I now call gitr log I have to hit enter until the end or q to get the next xargs call to run. Can I tell xargs to skip user input ...
0
votes
1answer
31 views

how to stop at a specific point in a list

I created a shell script called blossom() because my girlfriend's dog Blossom poops and pees on the floor all the time. blossom() { echo poops and pees on floor all the time } Because I am such ...
1
vote
1answer
35 views

Can less be instructed to collapse blocks of lines

Is there a way to instruct less to fold blocks of lines matching some criteria into a single line in the view? For example while viewing a mail spool with less, the mail headers may take up a lot of ...
12
votes
3answers
528 views

No colored output in less for the ls command

If I run ls I get colored output which I find pretty handy for quickly getting a glance of the kind of file. When I try to pipe it to less even with the -r and -R flags the coloring always get lost. I ...
4
votes
4answers
139 views

Viewing man pages with scroll wheel support

I'd like to use the scroll wheel (xterm mouse escape codes) to scroll through man pages, like I can in emacs with xterm-mouse-mode. less doesn't seem to have support for that and short of recompiling ...
2
votes
2answers
87 views

Exit from less by pressing ESC key

Can I setup less program to exit from it by pressing ESC key?
0
votes
2answers
54 views

Find out which encoding method less uses to display the content of a text file?

There is a plain text file, which Emacs can't display correctly, but less can. I wonder if less automatically detects the encoding method for each individual text file, or just use a single default ...
12
votes
1answer
1k views

grep inside less?

I'm currently sifting through a lot of unfamiliar logs looking for some issues. The first file I look at is Events.log, and I get at least three pages in less which appear to display the same event ...
3
votes
1answer
123 views

Make Less highlight search patterns instead of italicizing them

To my understanding man uses less as a pager, and when searching for keywords using less it "highlights" keywords with italics. I find that really inconvenient, so I'd like to change this to something ...
2
votes
2answers
55 views

What hotkeys are supported when reading a man page?

People usually know after running man fdisk that they can search with: /foo (where foo is the string to be searched for). They can also use Up/Down and PgUp/PgDown to scroll up and down. What ...
3
votes
1answer
160 views

How do I view cp1251 text file in UTF-8 console?

Attempt 1: $ less subs.srt "subs.srt" may be a binary file. See it anyway? <C8><F2><E0><EB><FC><FF><ED> ... Attempt 2: $ LANG=ru_RU.CP1251 less subs.srt ...
1
vote
2answers
91 views

Stdin Input Behavior Between “cat” and “less”

When I issue cat, the terminal hangs waiting for stdin input. However, when less is issued, I get Missing filename ("less --help" for help). It is known that both less and cat accepts stdin input. ...
1
vote
0answers
33 views

Delete lines from a file which opened in less mode

I have a file (huge size) which cannot be opened in vi but in less mode and I want to delete the lines which I do not required. But I am unable to delete lines from file open in less mode. Please ...
6
votes
3answers
475 views

How do I write all lines from less to a file?

I've piped a command to less, and now I want to save the command's output to a file. How do I do that? In this case, I don't want to use tee, I want a solution directly from less, so that I don't ...
2
votes
1answer
28 views

`diff -y file-{a,b} | less` and DOS line endings display issues

In my current job I often have to work with files from Windows machines which most of the time isn't a big deal, but when piping a side-by-side diff to less, not only are the ^M being displayed, but ...
3
votes
2answers
130 views

Man page highlight color

To colorize my man pages, I put this code from archlinux.org into .bashrc: man() { env LESS_TERMCAP_mb=$'\E[01;31m' \ LESS_TERMCAP_md=$'\E[01;38;5;74m' \ LESS_TERMCAP_me=$'\E[0m' \ ...
5
votes
4answers
151 views

Horizontal scrolling in smaller increments with less -S

I'm using less to parse HTTP access logs. I want to view everything neatly on single lines, so I'm using -S. The problem I have is that the first third of my terminal window is taken up with metadata ...
4
votes
1answer
62 views

Can 'less -F' be usefully combined with termcap initialization?

less -F closes less if the contents fit on one screen. However, if I use termcap initialization, i.e., I don't use -X and the file fits on the screen, nothing is printed because less displays the ...
1
vote
2answers
157 views

How does Bash pipe large amounts of data?

Let's say you want to cat the contents of a really big file, but want to view it a few bits at a time. Let's say one were to do the following: $ cat /dev/sda1 | less As a programmer of languages ...
3
votes
1answer
285 views

Can I add mouse support in less?

I've just discovered that I can add the following lines to ~/.vimrc. set mouse=a :vmap <C-C> "+y This has the effect of being able to select text with the mouse (i.e. in visual mode), and ...
3
votes
1answer
36 views

How to set `less` jump point to center of terminal rather than top

If one searches in less by typing /search term and jumping to search results with n and N the view of the text jumps so that the occurance of the search term is at top of the terminal. Displaying the ...
1
vote
1answer
169 views

Neither `less` or `less -X` clear screen on exit

Neither less or less -X clear screen on exit. At the same time, vim does.... Env iTerm2, protocol mosh, server Centos + tmux + zsh iTerm2: report term as xterm-256color tmux: set -g ...
0
votes
2answers
44 views

Are `less textfile | col` and `cat textfile` the same?

Do less textfile | col and cat textfile accomplish the same thing? I wonder if man mysql | col -b > textfile and man mysql > textfile do the same?
1
vote
1answer
102 views

Use case for /usr/bin/lessecho

I can not come up with an example of how I could/would use lessecho. The description in the man page is fairly straight forward but is not helping me come up with a use case: DESCRIPTION ...
4
votes
1answer
731 views

Which file defines the LESSOPEN environment variable?

please advise me about the following. On my Linux machine - I do the following: $ env | grep -i LESSOPEN LESSOPEN=|/usr/bin/lesspipe.sh %s So from env command I see that: ...
4
votes
1answer
57 views

How to export a subset of a 'less' output [duplicate]

Every so often I need to take a subset of a log file and save it into a file for later use. I use less a lot to view and search within the logs and for exporting the interesting part, I currently do ...
2
votes
1answer
82 views

Hide lines based on multiple patterns

I'm using less to view log files quite a lot and every so often I'd like to filter the output by hiding lines which contains some keywords. In less it's possible to filter-out lines with ...
5
votes
6answers
3k views

Command to output file content to stdout?

I know cat can do this, but its main purpose is to concatenate rather than just displaying the content. I also know about less and more, but I'm looking for something simple (not a pager) that just ...
2
votes
2answers
62 views

Live replacement, while viewing log using LESS

It's very convenient to monitor logs using less command - you see what is going with your system as it happening. The bad thing is that my logs are optimized for grep tool: each atomic action is ...
1
vote
1answer
56 views

How to make `less -FX' play nice with a 2-line shell prompt

My shell prompt is two lines long (a fancier version of [%n@%m %~]'$'\n''%#. I have $LESS set to -FX. When I quit less, it leaves a single line at the end of my screen, and since my prompt has two ...
1
vote
0answers
47 views

man causes a broken pipe when using a pager other than less

I'm trying to write a simple script to format my man pages, but I've run into a broken pipe error. These lines both cause the error: env MANPAGER=cat man $foo man -P cat $foo and this is the ...
5
votes
2answers
217 views

How do I preserve coloured output when piping to `less -R`?

$ ffmpeg -v debug ... Coloured output. $ ffmpeg -v debug ... |& less -R Dull output. How do I make the output coloured while piping it to something?
4
votes
3answers
335 views

Why can't ed be exited with C-c?

The program ed, a minimal text editor, cannot be exited by sending it an interrupt through using Ctrl-C, instead printing the error message "?" to the console. Why doesn't ed just exit when it ...
2
votes
1answer
16 views

When using less with -S option, it moves text on top when I press right key

I am using less as pager in MySQL, and I have configured it with -S flag, so that it does not wrap text. The only issue is that, when I have a small result set and want to see what is on the right, I ...
6
votes
4answers
480 views

How do I prevent less from clearing the screen on exit? [duplicate]

I often pipe commands to less in order to read through the output (e.g. compiler errors). MyCommand | less This is great because it makes trawling through large amounts of output easy, but when I ...
1
vote
1answer
168 views

Less command change color of “~” and “(END)”?

How do I change the color of the "~" characters that go along the edge of a Less command output. And how to change the color "(END)" at the bottom?