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.

4
votes
3answers
312 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.
3
votes
0answers
17 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
24 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 ├──◆ ...
4
votes
3answers
450 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
33 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
39 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
65 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] =&...
1
vote
0answers
25 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
36 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
92 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
111 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
27 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/...
2
votes
1answer
102 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
78 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
92 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
107 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
27 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
54 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
142 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 ...
3
votes
2answers
602 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
25 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
53 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
63 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
41 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
26 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
69 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
51 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
408 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
38 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
540 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
245 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
247 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
149 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
48 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
503 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
68 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
709 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
54 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
289 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 ...
3
votes
1answer
686 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 ...
1
vote
1answer
101 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
406 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
123 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
60 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 ...