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
1answer
73 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
66 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
74 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
96 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
23 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
51 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
36 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
167 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
22 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
47 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
36 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
48 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
31 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
19 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
41 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
47 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
180 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
33 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?
7
votes
2answers
416 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
135 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
152 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
104 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
39 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
415 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
54 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
48 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
406 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
46 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 ...
2
votes
0answers
201 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
396 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
65 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
300 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
89 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
51 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
81 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
201 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
60 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
97 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
1
vote
1answer
61 views

Hold the output of pager (man,more, etc) in Linux

I want to apply the following from the freeBSD to the Linux systems. When you browse through man, pages on bsd for example, if you interupt it anytime, the pager will still show it's output, unlike ...
32
votes
3answers
40k views

Open `less` scrolled to the end

Is there a way to open less and have it scroll to the end of the file? I'm always doing less app.log and then pressing G to go to the bottom. I'm hoping there's something like less --end or less -...
1
vote
1answer
163 views

'git show' does not pipe control characters for color

I'm trying to output a list of git-show results and pipe them into a pager. Unfortunately I'm unable to preserve color. This is the command I'm running: git log -n10 | awk '{print $1}' | xargs -d '\n' ...
0
votes
1answer
84 views

How can I configure less to recognize Ctrl-Left, Ctrl-Right

The less manpage says you can use CtrlLeft and CtrlRight to move the cursor by one word when performing line editing (e.g. entering a search string): ^LEFTARROW [ ESC-b or ESC-LEFTARROW ] (That ...
2
votes
0answers
30 views

Configuring `less` to show longer lines

I like to use less with -S flag to not break long lines. But I also would like some indicator that one line is not fitting on the entire screen, so that i do not miss on information in case the lines ...
1
vote
0answers
49 views

How to pipe tail -f to less +F? [duplicate]

I'm using a processing tool that reads a file and outputs a modified version of it. I have been working with it successfully like this: tail -15f log_file.log | log_colorizer But I would also like ...