A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

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
64 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
15 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 ...
3
votes
0answers
34 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
34 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
35 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
17 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
36 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
23 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
61 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
40 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
541 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
44 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.
4
votes
1answer
48 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
35 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
86 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 ...
4
votes
1answer
70 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
vote
1answer
31 views

less scrolling issue

I am working through a linux training book on a fresh raspberry pi install (Debian v10.0) and have noticed an issue when using less /etc/passwd. when using the keyboard controls to scroll down, it ...
0
votes
0answers
108 views

Git Bash can’t quit less pager- q not working

I was referred here from stack overflow. having an issue with Git Bash/ Git for Windows (Windows 10). It seems that I am frequently but not always unable to quit git commands when they open up the ...
2
votes
1answer
70 views

Is it possible to save filtered results from less

Related to: (grep inside of less) grep inside less? Related to: (save less to file) https://superuser.com/questions/290908/how-can-i-save-the-current-contents-of-less-to-a-file When I filter the ...
0
votes
0answers
31 views

Different color vim vs less in tmux

Both vim and less run inside tmux but they appear to have different white color, I really want to have less's white color in vim. In tmux I have terminal settings (st terminal): set -g default-...
3
votes
2answers
79 views

less: search, but ignoring special characters

I'm trying to view large log files. I have a complex shell script that will take a log file and run it through a tangle of text-mangling commands to insert formatting and colouring, and pipe the ...
1
vote
0answers
33 views

Continuously display new content of a file that contains a given word

When using less pressing Shift-F takes to the end of the file, and continuously display new contents. Is there any option (with any *nix tool) to continuously display new content which contains a ...
1
vote
0answers
46 views

how to mimic “tail -f … | grep …” using less?

When using tail -f some/filename, it waits for more to be appended to the file. Just like less +F .... However if I have a pipeline such as tail -f some/filename | ... then the less +F ... | ... does ...
0
votes
0answers
30 views

How does `less` listen to stdin commands [duplicate]

Say I run this: node file.js | less the less process can listen for stdin / keystrokes, for example if I hit q for quit or / to search for keywords. For example if I search for /p I see: So how ...
0
votes
0answers
41 views

colorchange in less status line

based on this, this and this questions I have tried to build a status bar with a dynamic part (line number, file name etc.) and a static part. (I am old and can't remember the useful shortcut all the ...
3
votes
2answers
72 views

How to disable `h` in `less` for help?

When I press h in less pager, it displays a help screen. For a seasoned vim/less user, this behavior is extremely annoying. How can I disable the h key for showing the help screen in less? >>&...
0
votes
1answer
53 views

Why would a file have NO color code? [duplicate]

Two files in one of my directories are rendered as gray on PuTTy. Running ls -l --color=always | less shows a list with most file names preceded by ESC[01;32m But those two files do not. The ...
3
votes
2answers
203 views

Using regular expressions in “less”

I'm trying to use a regular expression in the man page of Bash by using less. I press / in less to enter a pattern, and I type z and press the Enter. I expected it to not match upper-case z (Z), but ...
1
vote
4answers
2k views

Why use cat to view a file? [closed]

It seems that the purpose of cat is to concatenate several files. However, many people still use cat instead of less (or a similar program like more) to display a file. See, for example, the GNU m4 ...
2
votes
1answer
85 views

less search: show match with context before match (within less)

I would like to modify the search behavior when inside less: By default next match is shown at the very top line. Instead show me next match of word at 5th line of screen/ show 4 lines before match. ...
1
vote
4answers
161 views

Why do control-left and control-right (arrow keys) not navigate by word in `less`?

In less's line editing mode, the left and right arrow keys move the cursor backwards and forwards. I was hoping to use these together with the control key to navigate by word, as promised by man less. ...
0
votes
3answers
92 views

are there side-effects to remapping/aliasing less to vim?

I added the following to .bashrc to remap less to vim alias vsi='vim -R -c ":map Q :q!<enter>" -' # Vim Standard Input [readonly] alias less='vsi' the reason is that I don't want to maintain ...
2
votes
1answer
42 views

less toggle raw-ness while viewing output

I instinctively type less -R <file> whenever I want to view a file that might contain ansi escape codes (particularly for color). Sometimes if I'm using less in a long pipeline though I forget ...
1
vote
1answer
5k views

Ansible task for searching words

With my ansible task I wanted to check if openjdk is installed on environment. - name: Check if java is installed on environment shell: rpm -qa | grep 'openjdk' register: result As result I ...
1
vote
1answer
60 views

(Possible) inconsistent behavior of grep and less

I have a utf-8 file containing some Turkish text inside. (My system is MacOSX) $ file -I foo.merge $foo.merge: text/plain; charset=utf-8 When I try to see some Turkish specific characters by using ...
0
votes
1answer
41 views

Override less defaults

If I have LESS='-FRX' as a default environment variable, how can I, as an exception to the rule, run less with only -R, ie. override/nullify -FX?
0
votes
0answers
38 views

How to automatically scroll to requested command when the “General Commands Manual” is shown? [duplicate]

I sometimes end up requesting the man page for a "basic" command like set or pushd that is built-in into the bash/zsh shell. So I type: man set …and I end up here: BASH_BUILTINS(1) ...
3
votes
2answers
201 views

'less -R' not working

I got this in a file: \033[31mException log And when I do: less -R demo I get no colors: What am I doing wrong?
5
votes
3answers
2k views

How do I search a file using “less” for a value with a decimal point?

So I less my file: less myFile.log Then I try to search for a value: /70.5 I've since learned less uses regex, so . is a wildcard. I've tried to escape it with no success.
4
votes
0answers
94 views

Tailing file using less +F/shift-F, turn off line buffering?

When using tail -f, it prints each character as it is written to the file, but less +F won't print until it sees a linefeed. And if the data being written to the file does not contain linefeeds, must ...
0
votes
1answer
31 views

pstree using VT100 graphic chars [duplicate]

I am running pstree on MacOS Majave and wan to Show branches of processes using VT100 graphic chars: $ pstree -g 2 | head -n 3 ─┬◆ 00001 root /sbin/launchd ├──◆ 00049 root /usr/sbin/syslogd ├──◆ ...
6
votes
3answers
2k views

My bash shell doesn't start a new line upon Return, and doesn't show typed command

In my interactive bash shell run in lxterminal's window, I don't know what I have messed up. Typing Return key doesn't start a new line, but Ctrl-C will. $ ^C $ $ $ $ $ ^C $ ^C $ $ $ $ $ $ $ When ...
0
votes
0answers
54 views

Output in terminal after quitting program

I'm using Kubuntu with i3, and I've recently migrated from Manjaro because things. My terminal emulator is urxvt but, when I use programs such as vim, less or nano in the terminal remains the part of ...
1
vote
1answer
108 views

`less` open editor without immediately triggering a redraw in the terminal

I'm trying to switch to a workflow of mainly using less when I just want to read code and then using v to switch into an editor when I want to edit the document. This is GNU less on OS X, but I think ...
2
votes
2answers
553 views

How can I get less to display \n as a newline?

I have some files containing \n newlines that I am viewing with less. I would like to be able to have less display those newlines as actual newlines. For example an array: Array\n(\n [Color] =&...
2
votes
0answers
53 views

How can I keep colorful terminal output, but disable pagers

On macOS man uses the pager "/usr/bin/less -is" (see man's man page). When I type man , I see colorized output, and I like this. But, I prefer to use the terminal's find commands when using man, and ...
1
vote
1answer
76 views

Make man pages narrow and centered in the terminal

I have a wide monitor and the terminal opened at fullscreen. I want man pages to be narrowed to, say, 100 characters wide, and centered on the screen, like in emacs olivetti mode: https://github.com/...
1
vote
2answers
146 views

Can you interactively modify the terminal reset in 'less'?

I usually do not want to reset the terminal when I exit less (that is, I want the screen to continue displaying what I was looking at). Usually, when I'm on a new box and haven't configured it yet, I ...
0
votes
2answers
313 views

printf and backspace

I thought of playing around a bit with find -fprintf. In case you don't know what -fprintf does, it is the same as -printf but writing to a file you specify its name. Now, when I run a command like ...
1
vote
1answer
118 views

Turning off word-wrap with less during paging?

I can get the effect that I want from running less -S but it seems fishy to me that there is no way to render the input without word-wrap after the file is opened. Is there anyway to less /tmp/...