Questions tagged [less-unix]

It's a UNIX command to display a file.

Example: less file will display the file file.

See discussion in Meta for the history on why is used for this instead of , which is broadly used for CSS.

139 questions
474
votes
5 answers

Going to a specific line number using Less in Unix

I have a file that has around million lines. I need to go to line number 320123 to check the data. How do I do that?
Stole
  • 4,978
  • 3
  • 20
  • 18
351
votes
5 answers

How do you do a case insensitive search using a pattern modifier using less?

It seems like the only way to do this is to pass the -i parameter in when you initially run less. Does anyone know of some secret hack to make something like this work /something to search for/i
mk.
  • 26,076
  • 13
  • 38
  • 41
53
votes
9 answers

less-style markdown viewer for UNIX systems

I have a Markdown string in JavaScript, and I'd like to display it (with bolding, etc) in a less (or, I suppose, more)-style viewer for the command line. For example, with a string "hello\n" + "_____\n" + "*world*!" I would like to have output…
user961528
47
votes
1 answer

How do I keep colors when piping "jq" output to "less"?

I have a simple json file and if I pipe the output of "jq" into "less", the colors get removed. This works: # yey, lots of colors jq "." /tmp/myfile.json This doesn't work: # ugly output :( , no colors jq "." /tmp/myfile.json | less -R Any ideas…
filipg g
  • 483
  • 1
  • 4
  • 5
26
votes
6 answers

How can I view a log file from powershell console ? (i.e. powershell equivalent of 'less')

What is the powershell equivalent of 'less'? I see 'more', but it lacks some of the features I rely on (e.g. searching through the file) I seek a pager (equivalent of 'less') which allows searching (match or ignore case), multiple files at once,…
user331465
  • 2,984
  • 13
  • 47
  • 77
23
votes
6 answers

How to make Less indicate location in percentage

I now aim to show the percentage sign also when you run, for example, the command man emacs If you run it, you get 'byte 3300' for instance. Alex's answer suggests me that we need to make a separate shell function by man "$1"| col -b >…
Léo Léopold Hertz 준영
  • 134,464
  • 179
  • 445
  • 697
19
votes
2 answers

Find previous searches in less command

In vim, if I am in search mode by pressing /, I can press Ctrl+p to find my last searched string, and press that combination again to find an even earlier searched string, and so on. I can do the same on commandline in emacs mode. I want to do the…
Rushi Agrawal
  • 3,208
  • 2
  • 21
  • 26
18
votes
8 answers

Is there a way to look for a flag in a man page?

I'm trying to come up with a way to find a specific flag in a man-page. Usually, I type '/' to search for something, followed by something like '-Werror' to find a specific flag. The thing is though that there are man-pages (gcc is the one…
ferhtgoldaraz
  • 1,693
  • 3
  • 15
  • 20
17
votes
5 answers

Filter function for less +F

When watching a growing log file with e.g. "less -iS +F service.log" I want to limit the display to lines matching a certain pattern. I tried something like less +F service.log | grep | less +F which doesn't work. Also cat < service.log |…
axelrose
  • 556
  • 5
  • 17
16
votes
2 answers

How to search for multiple strings in a log file using less command in unix?

I want to search for multiple strings in a log file. Only those entries should be highligted where all the search strings are there in same line. Can i use less command for this or any other better option. My log file size is typically few GBs.
Satish
  • 1,037
  • 1
  • 13
  • 20
14
votes
0 answers

less: how to scroll horizontally by a screenful

Using the unix command line tool less, how do I scroll horizontally? I need to scroll one (or a half) screen to the right or left
Rajeev
  • 173
  • 1
  • 9
14
votes
3 answers

PSQL 8.3+ client query results display

Rather silly question, but I can't seem to find the answer in the docs or man pages. Starting with 8.3 I think, the psql CLI client will not display the results of a large query inline. It pipes to a 'less-like' result viewer that disappears when…
Sheldon Ross
  • 5,364
  • 7
  • 31
  • 37
12
votes
2 answers

Does less have an equivalent to vim's scrolloff?

I have scrolloff set to 4 in vim. This means that when I scroll up or down, there are 4 lines between the line I'm on and the bottom or top of the screen. When I use less, usually to view a manpage, I use / to search for text. If I'm looking for…
valadil
  • 1,648
  • 1
  • 14
  • 30
11
votes
2 answers

how to turn on word wrap in linux less viewer?

Word wrap mode of "less" viewer is disabled by default in the system I work on. According to "less" viewer help, it is disabled with -S or --chop-long-lines flags. I did not find how to force word wrap on my system. Is there any known flag, or any…
user1952686
  • 339
  • 1
  • 4
  • 12
9
votes
1 answer

Turn off counting line numbers in less command

In openSUSE 12.2, the less command counts line numbers when the file is opened. This causes a lot of delays when working with huge files. Is there a way to disable this option?
M.sh
  • 157
  • 1
  • 9
1
2 3
9 10