Stack Exchange Network

Stack Exchange network consists of 175 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
4answers
71 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
41 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
22 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
84 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
39 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
23 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
32 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
116 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
29 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
26 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
505 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
46 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
51 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
73 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
32 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
40 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
95 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
162 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
37 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
134 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
98 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
103 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
117 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
28 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
57 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
303 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 ...
5
votes
2answers
1k 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
28 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
54 views

Why only one side of NR work? [duplicate]

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 script below works too: set fac = 10 awk '{ if (NR ...
0
votes
1answer
43 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
70 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
43 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
30 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
81 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
61 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-...
2
votes
2answers
536 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
46 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
626 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
328 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
327 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
225 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
53 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
43 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
586 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
59 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
82 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
33 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 ...