Questions tagged [less]

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.

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.

183 questions
569
votes
17 answers

When reading a file with `less` or `more`, how can I get the content in colors?

When I read a file in Linux with the command less or more, how can I get the content in colors?
Open the way
  • 8,283
  • 13
  • 49
  • 69
554
votes
4 answers

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 couple columns. However, word wrap causes one…
User1
  • 9,112
  • 8
  • 35
  • 46
374
votes
6 answers

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?
Jesper Rønn-Jensen
  • 6,910
  • 7
  • 27
  • 34
287
votes
5 answers

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 | less EDIT: I'm looking for a direct solution…
Jeremy Powell
  • 6,799
  • 5
  • 23
  • 16
176
votes
17 answers

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 [multiple files] I'd like to stay in Less (to learn that…
Jesper Rønn-Jensen
  • 6,910
  • 7
  • 27
  • 34
126
votes
7 answers

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 to the top and using |avi to send the whole…
Jonathan Day
  • 1,581
  • 3
  • 12
  • 16
107
votes
1 answer

Less: Quickly Jump to Line Number in Large File

I'm struggling to figure out a way to do this...I'm using less to view a large (~1GB) file. I want to jump to line "$n" in the file - preferably without having to wait for lines 1-($n-1) to scroll by in my terminal. I would do this in vim using…
AJ.
  • 3,991
  • 8
  • 29
  • 34
71
votes
8 answers

Less or More in Windows?

Is there a command in the Windows DOS prompt that is equivalent to the UNIX less or more? Basically, the problem is that when I type hg log, the output has too many lines to fit on the screen and I want to paginate it. Any ideas on how to solve this…
Jeffrey Greenham
  • 819
  • 1
  • 6
  • 5
64
votes
5 answers

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 should I choose one over the other? They both seem to…
user541686
  • 23,663
  • 46
  • 140
  • 214
58
votes
1 answer

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. How is less doing this? Is it using any library,…
blueFast
  • 2,656
  • 9
  • 31
  • 44
46
votes
3 answers

Pipe to less but keep the highlighting

Is it possible to pipe output (e.g. dmesg) to a command like less (or equivalent) and keep the text highlighting used by the original command? example: on the left dmesg | less on the right dmesg
apoc
  • 673
  • 2
  • 6
  • 12
37
votes
4 answers

How to make mouse wheel scroll the less pager using bash and gnome-terminal?

I have two computers with the latest Fedora. On the first, I'm using zsh and the mouse wheel can be used with the less pager within gnome-terminal to scroll the pager. On the second, I use bash and the mouse whell scroll the terminal history, not…
user36520
  • 2,805
  • 3
  • 22
  • 19
37
votes
7 answers

Mercurial. Colour output piped to less

Operating system: Mac OS 10.6.2 I'd like to be able to see colour output when piping certain commands through less. Two examples: I've got ls aliased to ls --color=auto, so I'd like to be able to see colour when I do this: ls -l | less I've also…
mmacaulay
  • 683
  • 2
  • 7
  • 9
35
votes
2 answers

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 leaves the output in the terminal. I'm 100% sure…
ggustafsson
  • 1,964
  • 15
  • 20
33
votes
1 answer

How to center search results in Less, instead of moving matched line to top of terminal

When searching for terms in less, I'd like to see lines above and below a search result. Can less be configured to do this? Simple less usage is: - Open file - Search by typing "/" - Move to new search matches with "n" But each match is shown on the…
Vincent Scheib
  • 613
  • 7
  • 16
1
2 3
12 13