51

I have just installed Cygwin, and I have displayed a file's contents using the less command. Now I am unable to exit that in order to type other commands:

enter image description here

I want to exit this mode to type some other commands. How can I do that?

Elvin
  • 851
  • 2
  • 8
  • 9
  • 1
    I also use cygwin `cat` but it does not require to press anything when it has finished to print file. Add `cat --version` just in case to your question and perhaps a copy of your screen. –  Dec 10 '13 at 08:06
  • 1
    Sorry its less command I have updated my question accordingly – Elvin Dec 10 '13 at 08:12

3 Answers3

99

To quit less, type q.

Also, check out man less, or type h from within less for some more, useful bits of information.

In general, assuming man has been properly installed, man xyz will tell you how to use the xyz tool. On GNU systems like Cygwin or what you call Linux at least, man will usually display through less as well, so to exit from man, again you would type q (which also works in more or most which are other pagers used by man or other commands that need paging on other systems).

Stéphane Chazelas
  • 522,931
  • 91
  • 1,010
  • 1,501
user
  • 28,161
  • 13
  • 75
  • 138
  • Typing `q` does not work if I am using less under tmux, is it normal case? Please see: https://superuser.com/questions/1646175/pressing-q-does-not-exit-in-less-running-in-tmux – alper May 02 '21 at 20:02
  • Ironically, at least in my Terminal (iTerm2), running `man xyz` will actually run `less` and leave you in the same predicament – I found this question precisely because I’d run a `man` command and couldn’t get back to the regular prompt. – Janus Bahs Jacquet Feb 02 '23 at 11:48
  • This is not intuitive IMO... every other command can be exited with ctrl-C – SBF Mar 16 '23 at 17:11
2

I think you can exit by pressing Ctrl+C.

user
  • 28,161
  • 13
  • 75
  • 138
1

Just press Q (lowercase). No need to press anything else. Some times, you need a capital letter.

Kevdog777
  • 3,194
  • 18
  • 43
  • 64
nIZAR IBRA
  • 11
  • 1