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.

0
votes
0answers
11 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 ...
2
votes
2answers
43 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
50 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
70 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
542 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
26 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
83 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
48 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
662 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
46 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
25 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
127 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
35 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 ├──◆ ...
5
votes
3answers
590 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
47 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
56 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
88 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
35 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
41 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
99 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
202 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
59 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
172 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 ...
1
vote
4answers
121 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
106 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
136 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
30 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
23 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
58 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
448 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 ...
6
votes
2answers
3k 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
30 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
56 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
45 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
82 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
47 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
87 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
69 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
617 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
56 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
722 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
379 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
389 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
272 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
59 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/...