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
2
votes
2 answers

rake routes producing strange characters and breaks `| less`

I'm trying to do this: rake routes | less but it is producing the following weird characters, and breaking less so that it won't search or respond properly. This is new and used to work for a couple years. Something on my system has changed and I…
pixelearth
  • 13,674
  • 10
  • 62
  • 110
2
votes
2 answers

Remove all characters before specific number in Nth column at first match NOT last

I am trying to remove a random block of characters from the 5th column in a dataset. Sample data: A | 12 | AA | 24 | Test to go and keep 192.168.1.1 > 192.168.2.1 | B Result should look like: A | 12 | AA | 24 | 192.168.1.1 > 192.168.2.1 | B I have…
2
votes
3 answers

Cygwin 'less' command makes bash forget screen buffer history

I'm having some issues with my Cygwin terminal when I run 'less'. 'less' works fine, but when I come out of it, all the screen buffer history of the terminal is lost. Any suggestions? I'm running Cygwin on WinXP.
Bluefalcon
  • 23
  • 3
2
votes
2 answers

is there a special search command for options and commands in man-pages (in less)?

Question: using the less command in any linux shell (i'm using bash as probably most people do), is there a way to search a file only for it's commands or options? So, to be more precise: if i want to quickly find the description for one special…
2
votes
1 answer

Is there a way to retain responsive number of columns piping through less?

I have a simple script echo "Some Text" echo " " compgen -c a | sort | uniq | column echo " " This line set is repeated for each letter of the alphabet (not set in a loop) in 1stscript.sh. I have a second lessscript.sh. 1stscript.sh | less Running…
2
votes
0 answers

How to prevent less --quit-if-one-screen --no-init +G from filling the screen with empty lines when the file is shorter than the screen?

I use less -XFR +G to page some variations of git log, and all four options are important. The thing I don't like is that it fills the screen with empty lines (marked with ~) when the log/file is shorter than a screen. The issue comes as a…
Enlico
  • 23,259
  • 6
  • 48
  • 102
2
votes
1 answer

Break JSON in pager "less"

I use the pager called less since 20 years. Time changes and I often look at files containing json. A json dict which is on one line is not easy to read for me. Is there a way to break the json into key-value pairs if you look at the log…
guettli
  • 25,042
  • 81
  • 346
  • 663
2
votes
0 answers

How to jump to a file's nth character in Unix less

I have a decode error parsing a JSON file, all I am given is the location of the faulty character in the file: char 5960. My file has multiple lines. How can I jump to that nth character (or at least to the corresponding line) using less? Note: I…
Johann8
  • 649
  • 7
  • 20
2
votes
1 answer

using tail to follow a log and execute a command instantly? Only seems to work by starting a new line

I am trying to figure out a command which will enable me to read a log file in real time and execute a command when the string matches? I am using logkeys and trying to make it when I type a word it immediately triggers a command. This script…
user9546436
2
votes
2 answers

How do I pass options to less from git-diff?

I've got a fairly default setup for git on an OSX machine, but I'd like to add -j.5 to less, so that search matches happen in the middle of the screen. I tried doing export LESS=-j.5, but that caused content like ESC[1mdiff --git…
Andrew Grimm
  • 78,473
  • 57
  • 200
  • 338
2
votes
2 answers

Why I can run less, grep and find in Windows Powershell?

A friend told me that Windows PowerShell doesn't have these Unix-style commands. Well, I tried and saw that I can in fact run these. Now I'm wondering why is that. Could it be because I have installed NodeJs on this Windows machine? If they are not…
Steve Waters
  • 3,348
  • 9
  • 54
  • 94
2
votes
2 answers

Can't get git to automatically pipe diff/log to less (bash on windows)

Basically, I want git diff and git log to pipe to less automatically, so that my prompt isn't cluttered with code. When I run "git diff", for example, I get the following output WarriorPoet@JARVIS: /mnt/c/../Robot_one -> git diff diff --git…
WarriorPoet
  • 41
  • 1
  • 4
2
votes
1 answer

copy less wrapped line results in broken lines

In my less (and also vi, for all that matters), when I try copy a wrapped line by marking it with the mouse, only the part of the line where I double click is copied, e.g. lets say that this is a a very long line wrapped 3 times So trying to…
user2141046
  • 862
  • 2
  • 7
  • 21
2
votes
1 answer

Use less -S and less in alias

I always use less -S instead of less, so I create an alias less="less -S". But sometimes, I want to use less without -S. I tried something like les=less, but of course, it doesn't work because les calls the other alias less -S. Is there a…
Liad
  • 340
  • 4
  • 15
2
votes
2 answers

bash one-liner for opening `less` on the last screen w/o temporary files

I try to create a one-liner for opening less on the last screen of an multi-screen output coming from standard input. The reason for this is that I am working on a program that produces a long AST and I need to be able to traverse up and down…
user1042840
  • 1,925
  • 2
  • 16
  • 32