Questions tagged [less]

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

Filter by
Sorted by
Tagged with
1 vote
1 answer
20 views

Auto page down / scrolling after a few seconds using more, less, or something similar

When using more or less, the output is paused at the end of each page. Is there some way to have it pause only for a few seconds (configurable or not), and then continue to the next page? Is there ...
user avatar
  • 111
0 votes
1 answer
39 views

where in the FHS does command less store its buffers?

Using Kubuntu 20.04, which is running from an USB stick. Therefore there is a /cow overlay file system mounted on /. The USB stick has a total capacity of 32 GB, But to the cow overlay file system ...
user avatar
1 vote
0 answers
58 views

How can I recursively search file contents by ANDed patterns and print the output like ag/the silver searcher would?

This will be easier to explain via example. Here are my input files: file1: x x a b c x x file2: x x c b a x x file3: x x x x a b c x x x x file4: x x x x c b a x x x x file5: x x a b x x file6: ...
user avatar
1 vote
1 answer
26 views

Should one report the output of valgrind to less developers?

I found that in Linux Mint, the command valgrind less outputs still reachable: 22,499 bytes in 31 blocks Is that a bug? Should one report this kind of issues to the developers?
user avatar
  • 21
0 votes
0 answers
37 views

Want less cmd to clear content on exit in server

Want less cmd to clear content on terminal on exit in server and display back what was there before. I am used to this in my mac and wants the same behavior in the server. My internet search gives ...
user avatar
2 votes
1 answer
33 views

Is `git branch` using `less` a recent change? Or is `less` behaving differently recently?

Appologies for the vague title. I frequently execute git branch throughout the day, and it seems at some point recently (perhaps in the past month?) the behavior has changed. I recall previously git ...
user avatar
  • 2,064
2 votes
1 answer
19 views

less: custom shortcut for previous searches (up-arrow)

The less viewer allows some customization using the ~/.lesskey file, but it does not seem to have any effect in the context of searching. For example, I can map ^P to the up arrow, and this works for ...
user avatar
0 votes
1 answer
9 views

less -n default behavior, is not the same as indicated through man

For a MacOS and Ubuntu Server 20, with the command man less I can read the following: -n or --line-numbers Suppresses line numbers. The default (to use line numbers) may cause less to ...
user avatar
0 votes
0 answers
73 views

Arrow keys losing function during scrolling in less (MINGW64)?

I've just experienced a very strange problem I've never seen before. I use bash in MINGW64 (Windows 10 MSYS2), and less in it: $ bash --version GNU bash, version 5.1.8(1)-release (x86_64-pc-msys) $ ...
user avatar
  • 360
1 vote
1 answer
86 views

Why the LESS_TERMCAP settings does not work when put it into ~/.profile

I have the following LESS_TERMCAP settings: # less config export LESS=-R export LESS_TERMCAP_mb=$'\E[01;31m' # begin blinking export LESS_TERMCAP_md=$'\E[01;31m' # begin bold export ...
user avatar
4 votes
1 answer
154 views

Using anchor ^ pattern when using less / search command

When navigating through Linux man pages, sometimes you need to query the meaning of flags like -p or -al in the man pages. The default text reader for man pages is less and I'm trying to use the / ...
user avatar
  • 199
1 vote
1 answer
51 views

Does less block the input process from writing to stdout until the user advances a page?

I have a command which streams data from a server and writes lines to stdout. There is a large number of records that I would like to pipe to less, but I would like to prevent my tool from continuing ...
user avatar
  • 113
0 votes
1 answer
27 views

Make `less` exit after last page or `more` interpret colors

In a script, I’m doing a git diff that I want to quickly page through. When I’m finished, the pager will exit and the script will continue. more is great for the task, because I can space through it ...
user avatar
2 votes
4 answers
183 views

Why this word can't be grep?

I have access to busybox only, v 1.27. I'm trying to use a huge TXT file I extracted from a PDF document as a TXT dictionary, to be console friendly. The word I'm trying to get is the very first word ...
user avatar
  • 143
0 votes
2 answers
41 views

Search with less

In the output of wget --help I would like to quickly go to the place where the --header option is explained. I try searching with less. man less explains: /pattern Search forward in ...
user avatar
  • 861
1 vote
1 answer
28 views

How to add empty new lines in less (log viewer)?

When I monitor some log file with tail -F file.log, I can press enter to add some space between actual log lines and the new ones, for example: some log 1 some log 2 some log 3 some log 4 some log 5 ...
user avatar
  • 599
0 votes
1 answer
41 views

less: how to skip N files

From the less man page: :n Examine the next file (from the list of files given in the command line). If a number N is specified, the N-th next file is examined. How this number N can be ...
user avatar
  • 23
2 votes
1 answer
590 views

search last occurrence of string in less

What's the best way to search for the last occurrence of a string in less? ?string works for small files but doesn't seem to work with large or non-trivial syntax-highlighted files (eg, cat /var/log/...
user avatar
  • 51
0 votes
0 answers
40 views

How to get less to show percentage without taking up whole screen for short files?

I found that the -F -m +Gg options to less give me a percentage through a file that is immediately visible, which I would like to keep. However, I found that for short files, despite the fact that -F ...
user avatar
0 votes
1 answer
77 views

less a file with JSON rows - how to highlight/colorize the rows?

I have log files with json rows inside - less displays it as just plain text Can I colorize the output with less abilities? As well as I didn't find any less-compatible third party tool with json ...
user avatar
1 vote
1 answer
117 views

Setting LESS_TERMCAP_* variables with $(tput ...) in ~/.profile not working

This is my ~/.bashrc: # ...unnecessary lines skipped... # man colors LESS_TERMCAP_mb=$(tput blink) # start bold LESS_TERMCAP_md=$(tput setaf 2 ; tput bold) # start bold LESS_TERMCAP_me=$(tput sgr0) # ...
user avatar
1 vote
1 answer
48 views

lesskey: add alt+right keybinding to less

I used cat -vte to see what escape codes my terminal emulator sends when I press alt+right: ❯ cat -vte ^[[1;3C Then I added this escape code to my lesskey file ~/.less: \e[1;3C forw-scroll Finally ...
user avatar
  • 1,287
0 votes
1 answer
31 views

Mac Terminal Git + Less doesn't show the first line of output

I have problems with git and less commands output in the standard Mac Terminal app. For some reason, when I do git log or something else requiring less, it always skips the first line of output. There ...
user avatar
  • 161
0 votes
0 answers
23 views

In `less`, how to get search patterns to match ignoring any colors/highlighting/ansi-raw-stuff? (like the default when looking at a man page)

eg, in the man page for less itself, there's a bit like "less does", with the word "less" in green and the word "does" in default formatting, but nevertheless, when I hit ...
user avatar
  • 176
0 votes
2 answers
54 views

Page break characters for more/less

I am on Mac OS. I have a C++ program that generates 1000+ lines of data that I redirect to a file. I then use less / more to go through the file. I'd like to have less pause at user-defined chunks of ...
user avatar
0 votes
2 answers
92 views

what is difference between less and cat with respect to reading binary files?

While I'm trying to read the file /var/log/boot.log with less, I will get the this message: [amirreza@localhost ~]$ sudo less /var/log/boot.log "/var/log/boot.log" may be a binary file. See ...
user avatar
1 vote
2 answers
110 views

How to display stdout of command in `less` with as few keystrokes as possible?

I often find myself piping a command's output into less because less is far superior for studying the output than the normal terminal. While I can always append | less to every command, I was ...
user avatar
1 vote
1 answer
76 views

Does less Do Anything That zless Doesn't?

I've recently found the benefit of using zless to read log files that have rolled and been zipped. Is there any functionality in less that isn't in zless that might catch me out if I alias less to ...
user avatar
1 vote
0 answers
37 views

In Less, how to jump horizontally between search matches on the same line?

On pressing n, Less skips all the search matches in the current line and moves to the next line with a match (even if the lines are wrapped). How can I make it move the cursor to all the matches in ...
user avatar
0 votes
0 answers
98 views

How to format text file to be readable in terminal

I thought this would be an easy question to find an answer to online, alas not. In a nut shell I want to be able to open a text file to be formatted to be nicely readable in the terminal. Background: ...
user avatar
1 vote
1 answer
92 views

less in "tail -f mode" and ability to scroll horizontally at the same time

less -S is useful to have horizontal scrolling with arrow keys (like mentioned in Horizontal scrolling in smaller increments with less -S) instead of breaking long lines into multiple lines less +F, ...
user avatar
  • 2,245
2 votes
1 answer
104 views

How to redirect ls output into `less -R` if the output size is large

If the count of ls output is more than 20 could it be redirected into less -R, in order the keep the bash clean. If its less than 20, the output could printed into the terminal. When I do ls for ...
user avatar
  • 230
1 vote
0 answers
103 views

How to use less in a 'safe' way on files with huge lines?

I have a relatively large file, a minified json file which is about 4 Gigs. The file isn't huge...but a lot of programs choke on it because it's a single-lined file. I have noticed less works ok on it ...
user avatar
  • 319
2 votes
1 answer
126 views

How to write less buffer to stdout in interactive mode

My scenario is the following: When I ask the psql program for \help, it pipes its output to less. Sometimes, I would like to keep the help contents while writing my next query. I imagine this could ...
user avatar
4 votes
2 answers
480 views

Color-coded git diff -> less doesn't properly show color

I'm working remotely on a SLES11 machine (woe is me). On this machine, I'm using git, and specifically, git diff, which passes its results to less with some of colorization. Now, for some reason, ...
user avatar
  • 7,249
0 votes
0 answers
36 views

Why would less version 451 only show the EOF of a file?

When using less version 436 I can open a file with no problem, however when using version 451 there is no display and the EOF is reached automatically, eg if I use the -E option the script exits ...
user avatar
  • 1
0 votes
1 answer
30 views

How to get information from "less" stream

How to get information about the stream displayed by "less", especially but not limited to number of lines? Info: reading this answer list of less functions, I did not find out how to know ...
user avatar
0 votes
1 answer
31 views

Less, but only last element of every line?

So, I want to monitor live logs as they come with less +F, but the logs have a LOT of noise before the actual message - fortunately the line is segmented by | character, with the timestamp being ...
user avatar
  • 109
6 votes
2 answers
830 views

find pipe to less - why only correct lines are left when I press "up" key?

I by accident find a good way to filter useful lines of find: just pipe it to less and when it shows (END) at the bottom, press up arrow key and only correct lines are left. No Permission denied, no ...
user avatar
3 votes
1 answer
68 views

less doesn't page the output when called inside env

After an update I noticed that my bash profile for man colorization breaks paging. I don't know what changed but I narrowed it down to the fact that calling env less hello.txt results in contents of ...
user avatar
1 vote
0 answers
31 views

Why does `less` consume so much CPU with a reasonably sized file, fast disk and plenty of memory?

There seems to be a pathological case with one of the files I'm reading with less. The file is ~300MB in size, disk is fast (local NMVE) and the file can comfortably fit in memory, there is no ...
user avatar
  • 562
0 votes
1 answer
22 views

Pausing script execution until user quits out of `less`

Goal: less the contents (from a variable) and then ask the user whether the contents should be saved to a file (i.e., .recovered_object) only after the user quits out of less. The excerpt from my ...
user avatar
0 votes
1 answer
70 views

Output large file entirely in follow mode similiar to tail -f

Is there a command to output a large file and follow on directly in the shell stdout? I am aware of less +F or I could simply use tail with an ultimately high n like tail -f -n1000000 if the file is ...
user avatar
  • 158
1 vote
0 answers
84 views

Bash: how do I pipe the output of every command through "less --quit-if-one-screen"?

When I run some commands in Bash, I have no idea how many number of lines the output will be. If the number of lines in the output exceeds the height of my terminal, I will not be able to see the ...
user avatar
  • 1,832
0 votes
2 answers
142 views

Use awk to pull a very specific section out of a file

I am trying to write a script (well, a one-liner really) to extract the important part of a debug log, so that people can easily send it to me instead of dragging me onto a conference call or having ...
user avatar
  • 23
1 vote
1 answer
49 views

Horizontal scrolling pager with vi keys

less and most use j and k, but they don't use h and l for horizontal scrolling. Is there a way I can fix either of these to do that? or maybe an alternative tool that I could use as a pager that does ...
user avatar
-1 votes
1 answer
68 views

How do I navigate horizontally in less?

I'm viewing a wide (not necessary long) file using the less utility, without line wrapping. I can move right and left using my arrow keys (and even that's due to terminal magic I'm not well-versed in, ...
user avatar
  • 7,249
2 votes
1 answer
435 views

Command-line variable assignment and command execution

While researching more in-depth information about Bash subshells, I ran into an interesting execution that I would like to understand why it works. The execution involves assigning a string to a ...
user avatar
  • 187
4 votes
1 answer
358 views

Remove left padding of line numbers in less

If you toggle the -N switch within less, it displays line numbers. However, there seems to be an unnecessarily generous amount of padding added, even when the total lines is small. E.g. the output of ...
user avatar
1 vote
1 answer
551 views

Hide "Waiting for data... (interrupt to abort)" in less +F

When running less +F filename there is a "bar" in the bottom with the text "Waiting for data... (interrupt to abort)". Is there a way to hide this text while remaining in follow-...
user avatar
  • 13

1
2 3 4 5
8