Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

1
vote
0answers
20 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
32 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
83 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
0answers
23 views

less: missing filename using execvp() [migrated]

I am trying to use execvp() to run less however I keep running into the same error saying that: Missing filename ("less --help" for help) I'm assuming I am trying to input the file completely wrong. ...
0
votes
1answer
75 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 ...
0
votes
1answer
19 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/...
1
vote
1answer
79 views

`less` performs differently when invoked from Bash and from Git

When I view a large diff with git diff, it gets paged with less. This is confirmed by opening another window and checking data from ps -aux and /proc. However, when less is invoked by Git, it does ...
0
votes
3answers
73 views

How to compile LESS pager?

I would like to compile less with latest fixes. I do this: git clone https://github.com/gwsw/less cd less/ autoheader autoconf ./configure make But make says this: make: *** No rule to make target ...
1
vote
3answers
86 views

Using 'less' to leave text on screen for small files

I'm pretty sure seeing this customization of the less command on some colleague system long ago, in order to imitate 'more'. What I want: If the file is short (less that one screen long), it should ...
0
votes
1answer
98 views

How to make “less” exit with clearing the screen? [duplicate]

I have a question just opposite to Is there any way to exit "less" without clearing the screen?: my less exits without clearing the screen but I have never used -X. The options I use is as ...
3
votes
2answers
24 views

How to save marks in less for later access?

If I mark a line in less, the mark will lost when the current less session ends. So, let's say, if I often check the bash man page for READLINE section, I have to search ^REA every time. Seems like ...
0
votes
0answers
22 views

Is there a way to get `less` with terminal colors? [duplicate]

Simple question. Sometimes I less stuff to reduce clutter on my terminal. However, for commands like ls, grep, or git status, this makes me lose the pretty colors. Is there a way to retain the ...
0
votes
1answer
53 views

How can I improve below alias?

I want to run less -F command on latest updated log file of one binary (which creates logs with names which start with xtest*) which is in logs directory. I was able to create below alias in csh, but ...
1
vote
1answer
79 views

Jumping to end/beginning of line in “less -S”

The commonly used pager less can be started with the option -S, prevents it from breaking lines. One can then press the right and left arrow keys to scroll horizontally. Since the lines can be quite ...
1
vote
2answers
333 views

Where is less search pattern reference?

Where can I find reference for less regex search patterns? I want to search file with less using \d to find digits, but it does not seem to understand this wildcard. I tried to find a reference for ...
45
votes
2answers
3k views

How does `less` take data from stdin while still be able to read commands from user?

As most of you have done many times, it's convenient to view long text using less: some_command | less Now its stdin is connected to a pipe (FIFO). How can it still read commands like up/down/quit?
0
votes
1answer
23 views

How to control when `less` rings the (audio or “visual”) bell

less gives alerts by ringing the bell (by default) or flashing the display (called the "visual bell," when using the -q or -Q option). Some common situations where it emits this alert are trying to ...
0
votes
0answers
50 views

Why only one side of NR work? [duplicate]

I am very confused about one simple script with awk: I want to print a range of rows by passing variables, the script below works: awk '{ if (NR >10 && NR < 100 ) print $0 }' file the ...
0
votes
1answer
39 views

convert ncurses binary dump into text

I have a ncurses dump (with for example screen recorder from GNU screen) and I would like to convert it into text (there are some conversations in it, some lists and other things, all text, but ...
2
votes
1answer
58 views

Why do I not need to reset text attributes with less?

This script outputs 5 lines with the third one being underlined: #!/usr/bin/env bash set -eu bold=$(tput bold) reset=$(tput sgr0) underline=$(tput smul) echo 'line 1 line 2 line 3 line 4 line 5' | ...
1
vote
0answers
35 views

Less is broken inside GNU Screen

When using less or git log, about the first 30+ lines are missing. I'm using GNU screen in a 2x2 grid, less is running in the bottom right pane. tput lines returns 65, but that's the total number of ...
0
votes
0answers
22 views

git log creates nul files when less history disabled

I have this in my .bash_profile to disable less history files: export LESSHISTFILE="/dev/null" Now, when I run git log and search for something, it always creates a file named nul in the current ...
0
votes
0answers
57 views

when paging through using less, how do i bookmark a page?

I'm reading long files with less and would like to 'bookmark' my page, return to it later after having closed less. Is this possible? If so, how?
3
votes
2answers
49 views

How to pass a search pattern starting with $ to less on the command line

I just tried to pass a search pattern starting with $ to less: less +/'\$l' myfile.pl and I got There is no -l option ("less --help" for help) After reading the manual, I tried the alternate -p-...
1
vote
2answers
295 views

Turn off terminal bell in man pages and less

I'm wondering if there's a way to turn off the terminal bell for terminal applications such as man and less, e.g. when you're already at the top of the file/man page and press "k" to attempt to scroll ...
1
vote
0answers
34 views

'less' with header line kept at the top

Just like this question: I want to open a file with e.g., less -Sx32 file.dat, but as I scroll down, keep the top line locked in place. How can I do this with less?
8
votes
2answers
485 views

Is it possible to scroll beyond the end of a file in the less pager?

Is it possible to scroll past the bottom in less? Ideally, I'd like to be able to see the last line of the file I am viewing at the top of my terminal window (the rest of the screen may be filled ...
0
votes
1answer
188 views

Permission denied from /boot

when I typed less /boot/grub2/grub.cfg in tty2 i get permission denied an I did su - password and that did not work I am in fedora 20 64 bit
1
vote
1answer
193 views

docker-compose, less and SIGINT

I have a script that boots up a test environment using docker-compose. This script pipes the mixed stdout of many docker containers on stdout through less: # This is part of a larger script with some ...
1
vote
1answer
126 views

How to make `less` understand codepage?

LC_ALL=ru_RU.CP1251 less ~/t/show_discounts.js shows nonsense characters instead of showing this CP1251 file as it should be viewed. How to make less work well with specified encoding? Debian Linux,...
0
votes
2answers
47 views

how to save current page to file in 'less'?

So in Linux, less is used to read files page by page for better readability. I was wondering if you can do something like less file.txt > output.txt to get one page worth of file.txt and output/...
1
vote
1answer
40 views

Less discards first lines, -S does not work [closed]

less works very strange, discard several top lines, does not update correctly after moving up/down or left/right. Also -S does not work. If I move far right, less starts to work correctly, but keep ...
6
votes
3answers
451 views

pipe multiple commands to less

How can I do {$several_commands} | less and have less considere it as several files and enable navigation using :n and :p. That may not be the clearer explanation, so let us consider an example. I ...
0
votes
1answer
56 views

automatically quit less after a short time

I use less to view the text output of a command that has sensitive information. Less is good for this as it uses an alternate screen and wipes it after use. I'd like the less session to quit after a ...
1
vote
1answer
60 views

less command stop to work after set terminal title from .tcshrc

After I add following command to my ~/.tcshrc: echo "\033]0;${PROJECT_NAME}\007" The less command in a new opened gnome-terminal stops working properly. But more command is not affected. This is ...
0
votes
1answer
32 views

Search a pattern with less without losing the current one?

I use / for search. Once I press enter I use n and N to navigate. If I press / again though the old pattern is lost. 90% of the times I want to append the pattern and I have to retype, which I ...
3
votes
2answers
571 views

How to indicate start of line in less search of man pages?

I frequently refer to man bash to recall use of "history expansion" parts(events/words/modifiers). I know that the man part I need is "HISTORY EXPANSION". So I type in HISTORY EXPANSION in forward ...
2
votes
1answer
49 views

Custom terminal with less

Currently I have this in my "~/.profile": export PAGER='env TERM=fox less' However I just realized that this only works with "man", and not if you do something like this: less /etc/DIR_COLORS to ...
3
votes
0answers
243 views

Change Search Highlight Color In Less

I am a bit lost here on customizing the search/find highlight color or font format if you will. I understand that using LESS_TERMCAP_* we can alter the font format of less display. Full capabilities ...
2
votes
1answer
547 views

how to get less to show tabs as tabs?

When I view data with tabs in less, tab characters are expanded to spaces. If I then copy them directly out of my terminal using ctrl-c, they copy as spaces. On the other hand, more preserves tab ...
0
votes
0answers
40 views

How to separate expac data into columns and colour code each column in less?

Based on this thread reply on the Arch Linux forums I have this command: expac "%n %m %d" -l'\n' -Q $(pacman -Qq) | sort -rhk 2 | less To show me package name, package size and package description ...
1
vote
1answer
72 views

less -S not working

I would like each line of a file to show up on just a single line in the terminal when viewing the file with less. less -S is not working for me, no matter how I try. With the flag -S, whether ...
1
vote
1answer
365 views

less: multiple filter conditions with AND

How to specify multiple filter conditions connected with AND in less? I would like to filter a log having lines do NOT contain "nat" but contains an IP address 192.168.1.1, like: &/!nat &&...
1
vote
1answer
102 views

Why is LESSOPEN causing my command to hang?

I'm trying to read a filtered version of some files in less by using the LESSOPEN environment variable, but no matter how simple my preprocessor, the command hangs until I send it a SIGINT via Ctrl+C: ...
1
vote
1answer
56 views

Is there a way to disable the delay of less +F?

Running less +F file is very convenient because you can switch in and out of forward-forever mode with Ctrl-C and ⇧-F respectively. Unfortunately new lines appear with a delay, which is very ...
2
votes
1answer
88 views

Read concatenated output of tgz archive (with plain text files), with filenames, without unpacking in bash?

I have a bunch of text files/logs, which I'd like to pack into a gzipped tar archive, say: cd /tmp echo "My Content One" > aaa.log echo "My Content OneA" >> aaa.log echo "My Content Two" >...
3
votes
1answer
220 views

Open multiple man pages in less?

I've noticed that when running man command1 command2, the behavior is: first the man page for command1 is formatted and displayed in less, and then after that less instance exits (e.g. by pressing q), ...
1
vote
2answers
61 views

Applying a command to the current line in less?

Let's say we list /usr/bin with ls – this may look like: CC file2c man sscop Mail find mandoc ssh addftinfo finger ...
4
votes
1answer
51 views

How to configure less to read non-displayed data into a buffer?

I recently discovered that you can start and immediately background long-running source code searches piped to less: grep -r something | less & is there a way to direct less to read more of the ...
0
votes
2answers
122 views

How to display color by piping command to less?

When I use: msgattrib --untranslated pl.po to see untranslated strings from po file I've got strings in color, but not when I use: msgattrib --untranslated pl.po | less