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.

Filter by
Sorted by
Tagged with
1
vote
1answer
418 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
308 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
37 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 ...
2
votes
0answers
135 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 ...
1
vote
1answer
626 views

Ideal column widths in less

Is there a way to emulate/improve on the behavior of BSD's column -t in less? i.e. to set the value of less -x/--tabs=... automatically so that each column is 2 characters wider than the widest ...
1
vote
1answer
43 views

Filtering for “DEBUG” in less shows no results in some machines. Why?

Given x@x:~$ echo -e "DEBUG\nDEBAG" | less When attempting to filter the output in less with &DEBUG, no results are shown (on my work server). But then trying this in my home computer (Ubuntu 16)...
3
votes
1answer
44 views

Run commands of my own over a opened file in less. Is it possible?

I was wondering if it would be possible to run commands of my own over the less command. With this I mean being able to have a file open in less and then run some command of mine over what I'm seeing (...
0
votes
1answer
317 views

Bash always outputs to less, how can I turn this off?

After a recent update bash seems to always output to less, which is resulting in pagination for many commands. Does anyone know how to turn less off? Example output for systemctl status
1
vote
0answers
68 views

How do I quit a piped less without quitting the source process?

I started a process that generates files but also has a lot of printed output. I started the process and piped it to less. The process should have completed a long time ago. I ls the directory where ...
1
vote
4answers
214 views

Using More or Less in this Scenario [closed]

I'm taking an Intro to Linux class in college. Our teacher wants us to show a command that can be used for this question: "Display the contents of a file with paging control that provides line-by-...
2
votes
1answer
328 views

less under tmux treats wrapped lines as single lines, breaking paging

In tmux (v1.8), using less (v458) with a pipe or file that includes lines longer than the terminal width has started causing problems for me on Ubuntu. The pager initially scrolls beyond the first ...
0
votes
1answer
962 views

How to use terminfo to set colors for man and less?

I saw this question where the answerer uses termcap to define colors for less which then could be used for how man could be displayed. It said while termcap is obsolete, it's easier while terminfo is ...
5
votes
1answer
5k views

less command stuck in forward scrolling

When piping command output into less, I'll scroll to the bottom of the output using the mouse and I'll find less gets stuck in forward scrolling, preventing me from scrolling back through output. This ...
4
votes
2answers
432 views

Redirect the background process output to a pager `less` after finish running not to default terminal

By default, if you execute a background process ended with &, like ./test &, the output will be printed in the current terminal. How can I redirect the output to a pager like less when it ...
1
vote
1answer
153 views

scroll down by one line near the end of the file in less

I have a file with really long lines that I am trying to view in less. If I am near the top of the file, I can arrow right or use -S (to disable line wrapping) and then press down arrow or e and it ...
21
votes
2answers
2k views

less file1 file2 | cat — why does it work?

When I uss less file1 file2 I get both files shown in the "less buffer viewer", but less file1 file2 | cat prints the content of both files appended to stdout. How does less know if it should show the ...
4
votes
1answer
2k views

Difference between less -r and less -R

less has two options: -r or --raw-control-chars Causes "raw" control characters to be displayed. -R or --RAW-CONTROL-CHARS Like -r, but only ANSI "color" escape sequences are ...
6
votes
1answer
5k views

How can I pipe something to less over ssh?

I am trying to configure a mutt binding to pipe an email into an ssh invocation to process the mail on a remote machine with a script that displays some output using less. However, this does not work, ...
11
votes
2answers
700 views

How to use “less -F” without “-X”, but still display output if only one page?

I'm tweaking the pager of Git, but I've got some issues with it. What I want is: Always colored output Scrolling by touchpad or mouse Quit-if-one-screen And my current configuration is: $ git ...
3
votes
2answers
983 views

How to make lesskey terminal-independent?

In bash scripts we can use tput to set terminal-independent less variables: export LESS_TERMCAP_me=$(tput sgr0; ) Can we do the same thing with lesskey?
1
vote
1answer
163 views

less colored output with word-wrap disabled

TL;RD less -S -R gives colored output but lines still wrapped to next line. I'm requesting a http service (instagram api) which gives me json encoded data. I use prettyjson from npm to see colored ...
1
vote
0answers
93 views

problems with directing the output of pdfgrep to a file

I'm trying to search multiple pdf files for a pattern using pdfgrep. The command I'm using is pdfgrep --color always <pattern> */*.pdf > outputFile I'm directing the output to a file, ...
2
votes
1answer
403 views

Why zsh behaves as less when querying a (postgresql) database?

Context zsh shell, oh-my-zsh framework, no special zsh's configuration about postgresql. Trouble I noticed an annoying behavior: when querying the database, e.g.: SELECT * FROM mytable ; it ...
4
votes
1answer
242 views

FreeBSD: man exits at EOF

When using man to view manpages on FreeBSD 10.3-RELEASE-p11 I get back to the command promt after scrolling to EOF. What I want: man should not quit when I reach the end of the manpage as I may want ...
1
vote
2answers
275 views

less pattern - endswith [ ] or $

Refer to can-i-get-individual-man-pages-for-the-bash-builtin-commands: bashman () { man bash | less -p "^ $1 "; } This function will jump to the desired bash manual parameter section directly. ...
3
votes
1answer
115 views

How do you search through flags in the manpages?

Whenever I search the manpages, I'm almost always trying to find out what's going on with a specific flag. For example, when searching the man pages for pandoc I was searching the for -f flag. I'm not ...
4
votes
1answer
503 views

Why doesn't `less` show bold output? [duplicate]

I'm connected to a bash shell on my ubuntu 16.04 server using Putty on Windows. This is what it looks like in Putty when I do sudo fdisk -l: But when I try to pipe the output into less, the colors ...
1
vote
3answers
296 views

How can 'man' render double quotes not as doubled backtick and prime characters?

When I do a command such as: man bash I see quotes shown as: ``...'' There have been posts about why this happens: Man page quotation characters Why some strings are quoted with double backticks ...
7
votes
1answer
2k views

Getting gcc piped-to-less to properly show colors on the terminal

I'm compiling a file with gcc (actually I'm make'ing, but never mind), which sends some colorized error messages to stderr. So, I do: gcc a.c 2>&1 | less but what I get is lines such as: a.c:...
7
votes
1answer
4k views

Breaking out of follow mode with less and journalctl

An interesting annoyance that just plagued a coworker: If you less a file that's being appended to, you can hit shift-f to start following the output stream in real time. Then, to stop following the ...
4
votes
3answers
176 views

How do I add multiple “+” commands into less from the command line

What I know and use regularly I love how I can add commands to less with the +-parameter from the commandline. I like this for instant searching: $ less +/DHCP /var/log/syslog # result: syslog at ...
17
votes
1answer
6k views

When to use grep, less, awk, sed [closed]

I'm entering the world of Linux and at work I'm using grep more and more. By doing that I'm figuring out that sometimes it's not adequate for what I want. I was struggling with grep a few days ago ...
8
votes
2answers
2k views

Constantly display status line in less

I know I can have less show me the status line with =. Is there a way to have it displayed constantly and updated as I scroll through the file? When I use man it's actually done this way but I don't ...
4
votes
3answers
146 views

Ensure less clears screen

Is there a way to ensure less clears screen on exit? The opposite of less -X. The screen is not being cleared when I exit a man page in iTerm2, however the screen is cleared when using the default ...
3
votes
1answer
3k views

How to install less on Oracle Linux Server

Oracle Linux Server contains more utility, because it is smaller than less utility. How can one install less in this RPM based distro?
1
vote
2answers
138 views

less combined with sed color sequences prevents page breaks

If I use the command below which colors the lines output in yellow, it essentially turns less into cat, printing out the entire file and disabling all of the features I need with less, such as ...
3
votes
2answers
4k views

What does [?1049h and [?1h ANSI escape sequences do?

When I used shell in a box and when I call less command (echo foo | less) in ajax response there was this code: \u001B[?1049h\u001B[?1h\u001B=\rfoo\r\n\u001B[7m(END)\u001B[27m\u001B[K what does \...
12
votes
2answers
2k views

What is less doing with rpm, and how do I get that text without rpm

When I execute less package.rpm, less shows me all sorts of meta info about the package. What is less exactly doing - does it have built in code to be able to extract meta info, or is an rpm ...
10
votes
1answer
649 views

Cause `less` to exit with a non-zero status code?

I would like to have the following command structure: command && check-status | less && followup-command This would pause the execution while the user interacted with less. How can ...
2
votes
0answers
144 views

Paging with follow less +F and colorize with awk

I would like to paginate a file with follow, i.e. $less +F and also colorize the output on the screen. I want to use less because I can leave the follow mode, browse the file and then re-enter the ...
2
votes
2answers
54 views

Ouput to a file and read it [duplicate]

I am trying to output the ps command to a file in /home/username/ps.txt. I want to create the file on the go, write the output of ps to it and also read the same in a single command. I tried this: ...
9
votes
1answer
6k views

How to use less in a script without getting ESC escape characters?

When I use less at the command line the output is like but when I use less from within a bash script I get: How can I use less in a bash script and not get all the escape characters and have it work ...
3
votes
1answer
497 views

How do I make less STOP chopping long lines by default?

The web seems to be full of resources for making less stop wrapping long lines by default and chop them instead. I have the opposite problem. It is chopping be default and I want to make it stop. I ...
0
votes
1answer
185 views

How to Execute !gvim current line in Viewer?

Code find-xargs(less)-gvim %http://unix.stackexchange.com/a/277889/16920 find . -name "*.tex" -exec grep -il "agent" {} + | less -s -M +Gg Output ./InfectiousDiseases/1.4.2016.tex ./...
2
votes
0answers
228 views

Prevent scp and less commands reading interactive tcsh script

I'm using tsch through PuTTY, and let's start by this: please don't try to convince me to migrate to another shell...:) It's being a long time that commands like scp and less didn't work well for me. ...
4
votes
1answer
4k views

more less …skipping… when searching

When I search a file in less or more, it will remove lines and replace them with "skipping". Does anyone know what causes this and/or how to avoid it? After I '/' search a log file using either more ...
0
votes
1answer
371 views

Less quit behavior

I'm not sure how to describe this but I'll try by comparing it to vi. When I open vi, do something, and then exit vi it brings me back to the terminal where I can see all of the commands I had ...
10
votes
1answer
3k views

`docker logs foo | less` isn't searchable or scrollable but `docker logs foo 2>&1 | less` is

Using either one gives readable text. But only with the stderr redirect can one scroll or type /somepattern and get matches. Without it searching gives "Nothing to search (press RETURN)" and a ...
5
votes
5answers
2k views

How can I search for bolded or underlined text?

How can I search for bolded or underlined text? This would often be useful to search for keywords, which are often highlighted as such. For example, in this excerpt from bash(1): I might want to ...
2
votes
3answers
89 views

Get contents of a file from first instance to last instance of some arbitrary string

How can I view in less from the first instance of some arbitrary string "foo" to the last instance? This arbitrary string will be on most every line of the log. I don't want to do grep "foo" bar.log |...

1 2
3
4 5
7