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
0
votes
1answer
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 ...
0
votes
1answer
61 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 ...
0
votes
0answers
46 views

How to get output one page at a time in Fish shell? [duplicate]

I am using a Fish shell and when I search through file with grep, I usually get a long output, which is difficult to further search through. If I use something like this grep -r 'email' . | less, I ...
1
vote
0answers
34 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 ...
0
votes
2answers
42 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 ...
1
vote
1answer
17 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 ...
-1
votes
1answer
18 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, ...
1
vote
1answer
22 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 ...
5
votes
1answer
229 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 ...
0
votes
1answer
121 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-...
3
votes
1answer
32 views

Less stopped saving search history

less used to save my search history to $HOME/.lesshst. A few days ago it stopped saving any new search patterns. I still see the old search patterns in $HOME/.lesshst, but the new ones are not saved ...
0
votes
2answers
40 views

Extra characters appear in `less`

Many non alpha-numeric characters appear as jumbled mess when using less and man. Currently, I'm using zsh but the same problem happens in bash and sh. The problem also appears in both the st and ...
0
votes
1answer
35 views

How to set background color of $PAGER?

I usually set my terminal with transparent background. But, when I need to read a lot of text such as man, less, cat, etc., I want my background color to be solid black. I can change the backgrounds ...
0
votes
0answers
17 views

More advanced regex searching/filtering in less?

Is there a way to do more advanced regular expression with less? In particular, I want to search for something like "lines that contain X but do not contain Y or Z". This is doable with a ...
2
votes
2answers
88 views

Redirect output to less from inside script

I can redirect the output of a script to a logfile from inside the script with exec: #!/bin/bash exec > stdout.log 2>&1 echo hello world Is it possible to redirect the output to less ...
1
vote
1answer
21 views

prevent less linewrapp from breaking words — split on white space only

I want less's linewrapping to be smarter... when lessing through text it's wrapping lines in such a way that words get broken up which makes reading difficult. The smart way would mean only breaking ...
0
votes
1answer
23 views

Piping adb output to less behaves unpredictably

Using less to view the output of some adb commands often does not work as expected. For example hitting the spacebar to advance to the next screen often does nothing, but hitting the spacebar a second ...
0
votes
1answer
31 views

Pass output of all interactive commands to less?

In interactive bash session, is there a way to pass output of all commands to less? As if all commands typed in bash were followed by | less -RF? Sort of like setting pager=less -RF in my.cnf for ...
0
votes
0answers
46 views

Value is required after -x (--tabs)

I try to use "man command" but terminal gives me this output "Value is required after -x (--tabs)". What is this?
2
votes
3answers
557 views

Count the number of matches in less

In less, is there a way or trick to quickly count the number of matches instead of pressing N repeatedly and counting the matches manually?
0
votes
1answer
33 views

Can I change the regex engine used to search in `less`?

I would like to use a perl compatible regex engine in the less command line utility. Is that possible?
2
votes
2answers
140 views

View command output in scrollable pager

I would like to view the output of a command from the top and keep the terminal from jumping down, and I would like a terminal independent way for it. So without changing the terminal specific ...
6
votes
1answer
231 views

less - How to get matching line not be the top line on screen?

Very often happens that I do $ man someprogram to inspect the manual for some program. Often I also want to search for something in there, and I simply hit / and write whatever I want to search for. ...
0
votes
1answer
70 views

Redraw manpages with proper formatting after changing terminal font size

If I open a manual page in a maximized terminal and then increase the font size ("zoom in"), the text is still readable, but the formatting is distorted. Namely, the paragraph indentation ...
0
votes
0answers
38 views

Terminal editor/pager that allows jumping to particular line based on external command or file?

I'd like to script something so that an existing process viewing a listing file jumps to a particular line. The process might be less or nano or, if need be, another pager or editor. I would, if ...
0
votes
1answer
53 views

less -R (-r) doesn't produce colored output

I'm trying to get colored less output in my terminal. Below is how I expect the output to look, and underneath that what "less -r" or "less -R" actually produces. I'm using a build of suckless st ...
1
vote
0answers
24 views

How to prevent less --quit-if-one-screen --no-init +G from filling the screen with empty lines when the file is shorter than the screen?

I use less -XFR +G to page some variations of git log, and all four options are important. The thing I don't like is that it fills the screen with empty lines (marked with ~) when the log/file is ...
1
vote
1answer
52 views

How to do paging on nmcli help?

I'm watching online lectures on the nmcli utility (NetworkManager, Red Hat), and the instructor conveniently uses the package bash-completion to figure out what options are available after each ...
1
vote
1answer
59 views

How do I cancel the effect of “ESC-F” in “less” without canceling the running process?

When I use less, at times I like to have things go on for a while so I use the ESC-F sequence key which, up to here, does what I want. The only way I've found to go back to the normal less command is ...
2
votes
1answer
63 views

Piping curl http://cheat.sh/python to less is showing strange ESC[38;5;246m [duplicate]

I am kinda new to Linux. My base issue: I need to show the output of curl cheat.sh/python like a man or less page, so that I can easily scroll up and down. What have I tried: curl cheat.sh/python | ...
2
votes
0answers
41 views

How to search for end-of-line hyphenated words in less(1)

Does less (or any other lightweight pager I could use as $PAGER) has such a feature? For example, if I type man bash and then enter /incorporates it doesn't find the word, despite it being right ...
0
votes
1answer
110 views

Can I pipe colorized cat (ccat) in less? [duplicate]

I find out ccat which is a command to colorize the usual cat command. Is there a way to pipe this in less mantaining colors? If I do ccat config.json | less there's no color! Thanks in advance.
0
votes
1answer
155 views

How to set “less” and “lesspipe” correctly?

I had set less to a vim less functionality some years ago and I would like to reverse those changes. Therefore I started removing the alias from "~/.zshrc". Since after sourcing this file my system ...
0
votes
1answer
100 views

How can I change lesspipe's color scheme?

When I less /some/file.ext, I get syntax highlighting by /usr/bin/lesspipe. Unfortunately, the colors are annoying and have poor visibility on my distro, by default - it's Devuan 3.0. My question: ...
0
votes
1answer
162 views

Why is `man` outputing to stdout instead of $PAGER (less)?

When I run man [program], the man page text is output on the terminal (a la cat, without a pager that provides interactivity) instead of opening the man page file in less (so you can scroll, search, ...
1
vote
0answers
36 views

Customizing source-highlight's color schemes?

The source-highlight package is installed on my system. It highlights files I view with less using /usr/bin/lesspipe and LESSOPEN environment variable. Now, I want to change the color scheme this ...
5
votes
1answer
72 views

How do I exit less when reading from stdin when it is called with a single minus argument: “less -”

Is there a proper way to exit less - without having to kill the process? I accidently created a file called - (minus) and tried to view it with: less - Less than follows stdin and I did not find ...
0
votes
0answers
75 views

Termcap not working in Debian 10

I just installed a headless Debian server, so far with an old monitor for initial setup. While doing the initial configuration and setup, I noticed one "inconvenience" - less always keeps innards of ...
2
votes
1answer
112 views

Showing Image Metadata with Less Pipe?

I'm watching a video about less pipe and the maker is able to open image files and get back a bunch of meta-data: My system seems to have less pipe and I can view PDFs and compressed files with less, ...
0
votes
0answers
28 views

How to show streamed input with 'less'

I'd like to use journalctl -f and pass that content into less for the following reasons: Horizontal scrolling for long lines (instead of line wrapping) Easy vertical scrolling So less works fine ...
2
votes
1answer
75 views

Why doesn't Esc-[ scroll left in `less`?

According to the manpage for lesskey, the following keys are bound to left-scroll and right-scroll: \e[ left-scroll \e] right-scroll \e( left-scroll \e) right-scroll \kl ...
1
vote
1answer
59 views

Disable caching in `less +F` (make live output not wait for newline)

In less command there is a handy feature - live tail which is enabled via Shift+f when viewing a file. However it has a built-in caching - it doesn't output anything until it meets a newline symbol. ...
0
votes
2answers
144 views

Why is the 'less' command unable to read data from standard input?

The command less < brown_fox.txt will read the data from brown_fox.txt and print it on the screen. But if I want to read data from standard input or keyboard using less command, how should I go ...
1
vote
1answer
97 views

less scroll to the end without blocking

I'd like to pipe a process to less, and then issue a command to the scroll the end of the current piped text. That is, shift+G blocks if the command hasn't yet closed its stdout, so for a long-running ...
10
votes
1answer
837 views

Should `sudo less …` change the ownership of `~/.lesshst`?

Having performed a sudo less ... ... in order to view a restricted log-file and doing some searches with it, I found the ownership and group of my ~/.lesshst file changed to root:root (where ~ ...
1
vote
3answers
62 views

use less on content in clipboard

I copied some text and want to search through it using less. I wonder how I can directly use less on my clipboard content without having it saved first into a file or being echod etc.
5
votes
2answers
107 views

Restore interactive commands after accidentally overpaging pipe input to less?

Consider a script like this: $ cat example.sh #! /usr/bin/env bash for i in {1..90} do printf '%s\n' "$i" done sleep 10 printf '91\n' sleep 10 printf 'done\n' and suppose the output is piped to ...
1
vote
2answers
235 views

call less +&/pattern from bash to start less in grep mode (escape &)

inside less i can type &/!DEBUG|INFO to exclude DEBUG and INFO patterns from a big log file How can i send this from an alias, bash script or the command line > # start less at last ERROR >...
0
votes
2answers
109 views

Why less won't be displayed during the execution of a command substitution?

I have an interactive script that returns a path for cd to use in the parent process. Like this: $ cd $(myscript) During the execution of the script, I want to be able to display some information in ...
5
votes
1answer
160 views

Is there a way to go back to column 1 in less?

At times, my software (generally while testing) outputs very long lines, so I use the -S command line option which means I see one line instead of possibly many screens of data. Once in a while, I ...

1
2 3 4 5
7