0

"less" command works fine, though.

I can use "less" to display part of the file on the screen.

Supposedly, there is a "more" command, but when I type it in, it says "bash: more: command not found."

xhienne
  • 5,272
  • 1
  • 11
  • 31
ocras_ren
  • 13
  • 5
  • 1
    Because `more` is not installed in git-bash. You can run `which less` to check where `less` is installed. – ElpieKay Sep 07 '20 at 03:10
  • Git bash is not unix. It doesn’t contain the unix programs. Although I’m pretty sure less and more are synonyms for the same program – evolutionxbox Sep 07 '20 at 09:44
  • @ocras_ren : You could switch from git-bash to Cygwin, or use WSL. Then you have more available, though I don't see why you want to prefer this over `less`. – user1934428 Sep 07 '20 at 10:35

1 Answers1

2

You can benefit from the Windows more though:

alias more=/proc/cygdrive/c/Windows/System32/more.com

(This does not imply Cygwin: the git bash packaged with Git For Windows is based on MSys2, a stripped down version of Cygwin, actively kept up-to-date with Cygwin's source code)

That will work:

cat large_file | more

The bash alternative:

alias more="less -de"

(as commented: adding -d for --dumb and -e for --quit-at-eof makes this alias closed to what more does by default)

In both instances, you can add that alias in your %USERPROFILE%/.bashrc.

VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283
  • Please fix your first alias. It assumes that the OP has Cygwin installed, but if he really had, he would have the Gnu `more` already (which as this is included in the Cygwin distribution). – user1934428 Sep 07 '20 at 10:38
  • I think if you want to make `less` behave pretty much like `more`, the alias should be `alias more="less -de"`. – user1934428 Sep 07 '20 at 10:40
  • I don't have cygwin installed myself, just the regular git bash from git for windows. So there is nothing to fix. It does work. Without cygwin. – VonC Sep 07 '20 at 10:43
  • So, why are you using _cygdrive_ as part of the path? AFIK, git bash does not use the cygdrive convention to access the Windows drives, does it? I don't have git bash, so I can't verify it. – user1934428 Sep 07 '20 at 10:55
  • Based on [this](https://stackoverflow.com/questions/38563826/change-drive-in-git-bash-for-windows#38563857) discussion, the C-drive is supposed to be accessed by `/C`, while you are locating it via `/proc/cygdrive/c`. Are both ways officially supported? I did not find the latter one documented. – user1934428 Sep 07 '20 at 10:59
  • It does work with git bash. – VonC Sep 07 '20 at 10:59
  • 1
    @user1934428 For more on git bash based on MSYS2, for of Cygwin, see https://stackoverflow.com/a/3144417/6309 and https://stackoverflow.com/a/35099458/6309 – VonC Sep 07 '20 at 13:53
  • Thanks a lot for the link. I learned from it, that MSys2 (i.e. the base for GitBash) was _a stripped down version of Cygwin_, which probably explains, why you can see i.e. the _cygdrive_ pathes under /proc , just like in Cygwin. – user1934428 Sep 07 '20 at 14:33
  • 1
    @user1934428 Yes, I wrote those answers a few years ago, so that is why seeing `/proc/cygdrive/c` did not raise any concern for me. – VonC Sep 07 '20 at 14:38