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.

408 questions
570
votes
10 answers

Can less retain colored output?

Can I get less not to monochrome its output? E.g., the output from git diff is colored, but git diff | less is not.
ripper234
  • 31,063
  • 43
  • 82
  • 90
291
votes
5 answers

What are the differences between most, more and less?

I'm now using Arch Linux, and find a command most works like more and less. To understand the differences between them is a confusing problem. The question Isn't less just more? mentions the differences between less and more. Do you know the…
Hgtcl
  • 3,021
  • 2
  • 13
  • 7
256
votes
3 answers

Open `less` scrolled to the end

Is there a way to open less and have it scroll to the end of the file? I'm always doing less app.log and then pressing G to go to the bottom. I'm hoping there's something like less --end or less -exec 'G'.
Miles
  • 6,557
  • 3
  • 12
  • 11
191
votes
11 answers

Is there a way to dynamically refresh the less command?

I like the watch command, but it has its limitations. I'm curious to know whether I could mimic the functionality of watch with less. I'm mainly looking for the ability to scroll through my directory as it dynamically gets modified via a running…
Zaid
  • 10,442
  • 13
  • 38
  • 36
114
votes
3 answers

How do I write all lines from less to a file?

I've piped a command to less, and now I want to save the command's output to a file. How do I do that? In this case, I don't want to use tee, I want a solution directly from less, so that I don't have to rerun a long-running command if I forgot to…
Flimm
  • 3,970
  • 7
  • 28
  • 36
105
votes
4 answers

Is there any way to exit "less" without clearing the screen?

Relatively often, I find myself wanting to quit less but leave what I was viewing on the screen, to refer back to. Is there any way to do this? Workarounds? (My current workaround is to quit, then use more. So any workaround that's better than that…
Steve Bennett
  • 2,203
  • 6
  • 21
  • 25
103
votes
3 answers

grep inside less?

I'm currently sifting through a lot of unfamiliar logs looking for some issues. The first file I look at is Events.log, and I get at least three pages in less which appear to display the same event at different times – an event that appears to be…
forquare
  • 3,396
  • 5
  • 21
  • 32
90
votes
8 answers

Colors in Man Pages

When I look at a man page in my 'console' (not an xterm) I see some coloration, but I don't get this in my xterm's (e.g. konsole) is there any way I can enable this? hopefully a fairly simple solution?
xenoterracide
  • 57,918
  • 74
  • 184
  • 250
88
votes
3 answers

Unhighlight last search in 'less'

When you use a / forward search or a ? backward search in less, all instances of the file get highlighted. After I've found the instance of the word I'm looking for, what is the most correct way to unhighlight something? Currently I just press /…
VxJasonxV
  • 1,507
  • 2
  • 11
  • 12
88
votes
3 answers

The 'less' command-line equivalent of 'tail -f'

I would like to open up a file using less, and have it automatically scroll the file similar to tail -f. I know that I can do less file, and then hit Shift-F to forward forever; like tail -f. I need less because it provides the --raw-control-chars…
Stefan Lasiewski
  • 19,264
  • 24
  • 70
  • 85
80
votes
3 answers

How can I view gzipped files in less without having to type zless?

I am using Ubuntu, and I would like to be able to type less compressed_text_file.gz and page the contents of the text file in uncompressed form. Is there a way to do this?
Ryan C. Thompson
  • 5,398
  • 6
  • 29
  • 23
76
votes
6 answers

less searches are always case-insensitive

Trying to find out how to use case-insensitive searches in less I found this on serverfault. That seems to perfectly answer my question. The problem is: It doesn't work like that here (OpenSUSE 13.1; less 458). I had aliased less to less -WiNS but I…
Hauke Laging
  • 88,146
  • 18
  • 125
  • 174
74
votes
18 answers

Is there ever a reason to use `cat` when you've got `less`?

I used to use cat to view files. Then I learned that less is usually better, and is a must if the file is longer than a few dozen rows. My question: Is there ever a reason to use cat instead of less? Is there any situation where cat is a better…
Ram Rachum
  • 1,795
  • 2
  • 15
  • 18
73
votes
5 answers

less command and syntax highlighting

I need to use the less command with the syntax highlighting of the vim command for python, C, bash and other languages. How do I apply syntax highlighting colors according to vim colors for less command?
PersianGulf
  • 10,728
  • 8
  • 51
  • 78
66
votes
3 answers

Does "less" have a feature like "tail --follow=name" ("-F")

The command less can be used to replace tail in tail -f file to provide features like handling binary output and navigating the scrollback: less +F file The + prefix means "pretend I type that after startup", and the key F starts following. But…
Volker Siegel
  • 16,983
  • 5
  • 52
  • 79
1
2 3
27 28