I'm using the shell (M-x shell) to connect to a remote host via SSH. After launching some command line tools (mostly psql, the postgresql command line interface, but man would be the same for example), the shell is giving me the following warning:

WARNING: terminal is not fully functional                                                    
-  (press RETURN) 

As far as I know, this looks like a pager problem. Changing the pager to cat in my .emacs file:

(setenv "PAGER" "/bin/cat")

helped me get rid of those messages, but only for local commands (and I do not mind using cat as a pager). As I only have one local instance of Emacs, is there a way to use a different pager on the remote host? Or any other way to get rid of the warning messages, if possible without switching to ansi-term? If it's of any help, I'm using GNU Emacs 24.3.1.

  • 4
    Alternatively, use M-x ansi-term to run a fully-functional terminal, rather than using M-x shell.
    – phils
    Oct 12, 2014 at 23:18

1 Answer 1


The "problem" is that with M-x shell (or M-x eshell btw), Emacs uses a very limited terminal emulator, so that TERM is correctly set to dumb

Fancy pagers cannot operate under such limited constraints, which is why you have to use cat instead. Now, when you open an ssh connection from that shell, TERM is still dumb, but PAGER is reset to whatever the other system thinks you should use. In order to fix this, you need to alter your shell configuration on the remote system so that it uses decent defaults whenever it's accessed from a dumb terminal.

Something like:

[ "$TERM" = "dumb" ] && export PAGER=/bin/cat
  • Thanks for the answer. As I'm not supposed to modify the remote server settings, I could either try to send env variables with my ssh connection string... or just get used to ansi-term! Oct 13, 2014 at 11:38
  • is there a pager that will display color?
    – erjoalgo
    Oct 17, 2015 at 15:53
  • @erjoalgo For colors, you can use ccat instead of cat. The result is really sweet :)
    – prosoitos
    Mar 16, 2020 at 6:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.