less is a terminal pager program on Unix, Windows, and Unix-like systems used to view (but not change) the contents of a text file one screen at a time.

learn more… | top users | synonyms

52
votes
1answer
3k views

How does less display PDFs?

I have tried several programs: pdftotext, pdf2txt.py, ... All of them can extract text from PDFs, but the one which is doing the better job is good ol' less: the text from the PDF has a proper layout. ...
0
votes
1answer
26 views

combining tail -f with less +F does not work

I am using ubuntu bash. I am trying to combine tail -f and less +F like below and nothing is coming out. tail -f long_running_log | less +F long_running_log is a log file constantly being written ...
3
votes
3answers
617 views

Viewing zip archive contents using 'less' on OS X

I couldn't help but notice that the 'less' program on all of the recent distributions of Linux that I've used (Ubuntu and Gentoo in this case) allow me to view the contents of ZIP and TAR archives, ...
5
votes
3answers
400 views

Let less work like cat, if only one screen full of text

On my Debian machine here, less always opens the alternate screen to show stuff. This is annoying, if there are only 2 or 3 lines to be displayed. I'd like less to: work as pager, if there is more ...
12
votes
1answer
4k views

How do i get the git pager to clean up screen output after exit?

The pager less doesn't clear the screen as it should do when i use git. I use less all the time and it usually doesn't leave output in the terminal after quit but when less gets executed via git it ...
1
vote
8answers
316 views

How can I get file information in 'less' like with 'man'?

When I view a file in Linux with the 'less' command, I often only get a ":" prompt in the bottom left corner. There's no clue about how long the file will be, or at which location I am currently. When ...
18
votes
4answers
825 views

Linux command line log viewer which allows auto tail AND searching?

I use tail -f in my Linux shell, to view log files, as I like how it auto-updates with the incoming text: I like to see the new stuff come scrolling in. However, I also like the search functionality ...
69
votes
12answers
22k views

How to syntax highlight via Less

is there a way to syntax highlight a file I see in Less? actually I'm using this command to open an xml file (and sometimes a series of them) less htmleditors/htmleditors_config.xml or less ...
0
votes
0answers
22 views

Color lines in less based on content

I have a log4j file I am searching through with less and would like to make the lines for different levels of logging be different colors. Log4j has levels like DEBUG, ERROR, and INFO which show up ...
1
vote
0answers
46 views

Can vim be used to view a growing file?

I often use vim's view for viewing files. Is there a way to use it for a growing file so that I can see the progress as it's happening? Something similar to tail -f or less +F I have two use ...
171
votes
4answers
40k views

How to turn off word-wrap in less

Short version: How can I make the less utility in Linux not wrap lines? Long version: Often I need to view huge CSV files using less with hundreds of columns. I frequently only care about the first ...
8
votes
3answers
374 views

How to do a multiline search in less?

In less, can you search using / for a pattern that contains a carriage return and newline? I know your pattern can end with a line using $ (from How do I include newlines in a search in less?), but I ...
0
votes
0answers
32 views

How do I set $LESS invocation options in a lesskey file?

I'm trying to use less's lesskey-file support, as described in the manpage: KEY BINDINGS You may define your own less commands by using the program lesskey (1) to create a lesskey file. This ...
2
votes
2answers
77 views

Can less wrap lines like fmt does?

Like most people I use less as my terminal pager. Occasionally I view files consisting of very long lines of plain or marked-up text. By default less folds these lines at the terminal window edge. ...
128
votes
10answers
56k views

Get colors in 'less'' command

when I read a file in Linux with the command 'less' or 'more', how can I get the content in colors?
48
votes
4answers
17k views

less is more? Is more less? I'm so confused

When I first heard their names, I got really confused when I tried to guess what these tools might do, I thought I'd misheard something. What's the difference between more and less, i.e. why ...
0
votes
0answers
68 views

Why does read's timeout break my console?

I have a script that is causing an issue, I've boiled it down to this; #/bin/bash read -t 1 -p 'Wanna continue?' less +F readTimeout.sh echo 'Wont get printed' The original script operated by ...
0
votes
2answers
81 views

`less` starts `ed`

I can't make less use my favorite editor. To my horror, it starts ed which I've never used and really am not going to. > echo $EDITOR emacsclient > less somefile Pressing v starts ...
40
votes
5answers
8k views

How can I save the current contents of less to a file?

If I've piped the results of a command to less and then decided that I want to save the contents to a file, is this possible? I've tried setting a mark a at the end of the buffer, and then returning ...
0
votes
0answers
20 views

`less` stick to bottom of screen

If I pipe the output of a program to less, how can I force the scroll position to stick to the bottom? The default behavior is for each line to be printed until the screen is filled, and continue to ...
7
votes
2answers
1k views

copy and paste tabs between terminal windows in X11

When I copy and paste text using the X11 mouse selection between two terminal windows, tabs are often, but not always, converted to spaces. This appears to depend on the involved terminal ...
1
vote
0answers
85 views

Neither less or less -X clear screen on exit. (Trust me, I googled…)

Neither less or less -X clear screen on exit. At the same time, vim does.... Env iTerm2, protocol mosh, server Centos + tmux + zsh iTerm2: report term as xterm-256color tmux: set -g ...
5
votes
2answers
480 views

on quit, 'less' does NOT clear its contents when run in a 'screen' session [duplicate]

Possible Duplicate: Using screen, commands like less and man don't clear the screen afterwards When I quit 'less' in a normal bash, it clears the previous contents displayed by 'less' ...
0
votes
1answer
340 views

How do I make less open binary files without confirmation?

I have several log files that contain a few bytes which are not displayable characters (due to binary signatures on the requests). Every time I open them with less I get asked: $ less ...
0
votes
1answer
38 views

less maximum buffer size?

I was messing around with my system and found a novel way to use up memory, but it seems that the less command only holds a limited amount of data before stopping/killing the command. To test, run ...
1
vote
1answer
308 views

Less - Select to clipboard

In Less (Linux terminal), I can select lines with the mouse and then use Ctrl+Shift+C to copy to the clipboard. This only works within the displayed part of the terminal. How can I select more text? ...
0
votes
2answers
78 views

How do I view the content of a very large file at position in Linux?

I've got a file containing JSON data that is about 90MB of size and has one line. I need to go to position 99376229. Unfortunately vim and less both crash when I try moving to that column. How can I ...
3
votes
4answers
2k views

LESS syntax highlighting in Geany

I'm using LESS CSS (PHP version). I'm also using Geany in Linux. Is there a LESS syntax file for Geany out there, or how I can go about editing the CSS one to suit LESS?
2
votes
1answer
285 views

Line-wrapping `less` in OS X (specifically for use with 'git diff')

Using less +-S does not work (although it does ask Chop long lines (press RETURN)), and entering -S once inside less also does not work. Is there a solution? I am usig OS X Mavericks (10.9.3). ...
0
votes
2answers
734 views

“Less” prompts for “binary file” display when colors in output

We've recently enabled colouring the log files of a few services, I believe we use ANSI escape sequences for that. Looks like this: [2014-06-12 10:56:43,214] [main] [VOID] ESC[34mINFO ESC[0;39m ...
0
votes
1answer
30 views

less -S server.log (unix)

For a better understanding I prefer to read the logs with no wrap lines. In less I can get this with the -S option. The problem is that I can not select and copy rows that go beyond the right side ...
3
votes
1answer
143 views

Why does cd print when run in command substitution?

If I use the 'cd' BASH built-in in a command substitution, it prints extra stuff to stdout, but only when piped to, eg., less. $ echo `cd .` # The output is a single newline, appended by echo. $ ...
0
votes
0answers
52 views

Need to CTRL-C “less” in order to see file?

I have never seen this behavior before using "less" and am wondering if it speaks to a corrupted file? Typically when I use less <filename> the file is immediately displayed. In the case of a ...
1
vote
1answer
59 views

less command is unable to show pdf file in cygwin/mingw

I use less to read pdf in linux. While either in mingw or cygwin, less is unable to show pdf in the right way. looks encoding issue. Any help? thank you!
0
votes
1answer
60 views

How do I quickly search through large ascii files with less?

I'm looking through some large log files (1-10 GB) and have been running into trouble using the standard less search functions (/). Searching for strings takes several minutes to find a match. I ...
0
votes
1answer
715 views

Associate .less files with notepad ++

I just love notepad++ however I'm working with .less files and when I open a .less file it's just a normal text not a language (css) no code highlighting is there a plugin or something to make ...
112
votes
5answers
25k views

Less and Grep: Getting colored results when using a pipe from grep to less

I use the --colour option of grep a lot, but I often use less as well. How can I pipe grep results to less and still preserve the coloring. (Or is that possible?) grep "search-string" -R * --colour | ...
1
vote
1answer
41 views

How can I switch line-wrapping on and off from within less

I know I can run less -S and avoid long line wrapping. But can I switch wrapping on and off from within less?
0
votes
2answers
234 views

How can I make Unix Less wrap long columns?

I need to view a large tab delimited file using less. There is a column with ~200 characters which I am not interested in seeing but that column pushes all other columns to right making the viewing ...
1
vote
2answers
41 views

Why is GNU `less` just showing the output of my title script instead of the file contents?

I'm using csh as my terminal and I have a script that runs when I change directories that replaces the window title with the current directory. I have it run initially in my .cshrc file as well so ...
4
votes
2answers
1k views

Ctrl+c in a sub process is killing a nohup'ed process earlier in the script

I didn't know whether this belonged on SO (as it is a coding bug) but thought you guys would be more knowledgeable regarding the subtleties of the software used (so maybe even U&L could be ...
1
vote
0answers
37 views

Is it possible to have less +F with lesskey's that work without interrupt?

My situation is that I currently have some lesskeys set. And they do things fine in normal mode, but I want to have the file that I'm view also be updated. This is obviously possible with less +F, ...
96
votes
3answers
25k views

less command with multiple files: How to navigate to next/previous

I just found out I can use less with multiple files. less status line tells me (END) - Next: file2.txt But how do I navigate previous/next from less?
4
votes
2answers
388 views

PHP output piped to 'less' is requiring <enter> after every command

Piping PHP output to the linux 'less' command causes 'less' to really act up. (CentOS 6.2, didn't happen with CentOS 5.) When I pipe output from php into 'less', it requires the enter key be pressed ...
0
votes
0answers
94 views

Special and diacritic charactres using less, cat and other linux tools

I am using GNU bash, Version 4.1.10(4)-release (i686-pc-cygwin) and set up my .inputrc to allow for special characters and German umlauts etc.: set meta-flag on set convert-meta off set output-meta ...
1
vote
1answer
178 views

Less in cygwin can't read file created from redirected windows cmd script

I'm running windows cmd script from windows console and redirecting output to a file by mycommand.cmd > 'filename ' 2>&1 the problem is, when I'm trying to read that file using less under ...
4
votes
4answers
2k views

Change less (pager) default options

I'm using Ubuntu 10.04. My default pager(set using update-alternatives, not $PAGER) is less. The problem is, when I use ri(Ruby documentation tool) with the '-f ansi' mode, less shows the escape ...
3
votes
4answers
621 views

Unix command to empty logfile from within “less”?

I prefer using "less" to reading logfiles. As opposed to "tail -f" I can both follow (Shift + F), stop (Ctrl + C), and navigate up and down u and d, etc. Now what I really would like is the ability ...
0
votes
1answer
174 views

less: continue search from top

Is there an automatic way (through command line params for example) of keep searching from start of text when the end is reached? (same as Notepad++ - Continue Search from top but with less linux ...
0
votes
1answer
357 views

After running less command in -bash, instead of a prompt, I get “(END) ”. What's happening, and how do I get the prompt again?

I run the bash command "less" on a .txt. After printing out the lines in the file, the name of the file and "(END) " is printed. But I do not get a command prompt again. Other than closing the ...