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

0
votes
0answers
15 views

How can I get less to follow foreman? [on hold]

I'm running a rails app with foreman: $foreman start -c web=1,all_worker=1 all is great and I get output to the console. Now, I want to pipe that output through less so that I can play around with ...
0
votes
2answers
30 views

How to open compressed file in less mode [duplicate]

How do I open a compressed file in less mode. I am able to grep using zgrep and using zcatI can open, but the file is big I want to open in less mode.
2
votes
1answer
89 views

How to disable log feature of less command?

I use less command a lot to view files, but when viewing a file, sometimes accidently I typed s key within less then the log feature would be activated, and if I didn't notice that log in the bottom ...
0
votes
2answers
51 views

How do you search ! in man sed?

You cannot search ! directly because it puts process behind. For instance, you cannot search ! in sed man. How can you search ! in man?
15
votes
3answers
2k views

How to “less” a file named “-”?

I accidentally created a file with the name - (eg, seq 10 > -). Then I tried to use less to view it, but it just hangs. I understand that this is happening because less - expects input from stdin, ...
4
votes
1answer
35 views

Gedit displays text, but cat tells a different story

I am trying to sort a dictionary from Grady Ward's Moby and have encountered a bit of a problem. When I open it in gedit, I get: abaca×N abaciscus×N abacist×N aback×v abacli×p Abaco×N abactinal×A ...
8
votes
1answer
72 views

OS X, bash: less works on open file descriptors, cat doesn't

In a bash script I'm working on (which has to run on Ubuntu and OS X), I need to redirect the output of hundreds of commands to a file. Rather than appending &>... to all of them, I simply do ...
10
votes
2answers
581 views

Open a .raw file as text in less

The output of my program has a .raw file extension. If I try to open this with less I get: No isoinfo available Install mkisofs to view ISO images The file isn't an image file, it's just text. Is ...
2
votes
0answers
18 views

Pager that would work with header-lines? [duplicate]

Is there any pager, like less, that would allow paging result, but keeping configurable number of lines at the top always? Example: I run a query that returns many rows from database. Results are ...
1
vote
1answer
32 views

man page search - how can I turn off the highlighting after matches found?

When using man pages, a commonly used feature is to use / then a search term to get to a word of interest. Once found, all matches remain highlighted - this can often be distracting when I just want ...
0
votes
4answers
76 views

“emacs: standard input is not a tty”

I followed http://unix.stackexchange.com/a/43460/674: after $ locate -i linux | less I type g|$emacs - in less, but nothing is opened in Emacs, and the terminals says: emacs: standard input is not ...
0
votes
1answer
22 views

regain regular expression search pattern while using less command

I need to regain regular expression search pattern while using less command. Is there any way to do that?. Once I start searching the expression disappears.
0
votes
1answer
34 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
46 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
33 views

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

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
59 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
29 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 ...
3
votes
1answer
44 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
129 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
36 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
38 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 ...
6
votes
1answer
124 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
53 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
39 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
78 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
37 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
36 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
604 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
184 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
125 views

Exit from less by pressing ESC key

Can I setup less program to exit from it by pressing ESC key?
0
votes
2answers
62 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
2k 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 ...
4
votes
1answer
191 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
56 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
212 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
114 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
44 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
568 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
31 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
173 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' \ ...
6
votes
4answers
199 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
2answers
83 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
187 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 ...
6
votes
2answers
394 views

Can I use the mouse to properly select text 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
38 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
191 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
46 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
111 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
834 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: ...