pipe a program into less

5

1

I'm taking the dive into setting up and learning git and at the same time learning bash. I'm trying to do something simple as view the help section of

$ git config

unfortunately, when I type that the output of the help goes off the screen. Doing some googling I found less to be the program I want to use to scroll.

I tried

$ git config | less

with no success. Any ideas? Thanks!

coderdave

Posted 2010-09-25T20:41:41.247

Reputation: 205

Answers

11

Git is probably writing its output into standard error stream instead of standard output stream because command parameters are not correct. Please read about Unix standard streams here.

To fix the problem you have to redirect the error stream into output stream like this:

git config 2>&1 | less

user49531

Posted 2010-09-25T20:41:41.247

Reputation:

5

Piping only redirects stdout. If you want stderr as well then you need to redirect that to stdout first.

git config 2>&1 | less

Ignacio Vazquez-Abrams

Posted 2010-09-25T20:41:41.247

Reputation: 100 516