I cannot using the command "clear" to clear the screen in emacs shell mode as I can in the linux terminal. So how can I do it?

5 Answers 5


Shell mode is not a terminal emulator, the way that M-x term is, so "clear" does not have meaning there.

  • What's the difference between term and shell in emacs?
    – user2195
    Commented Aug 14, 2011 at 6:59
  • 1
    term is a full blown terminal emulator think of it as xterm running in emacs where as shell is just a basic pipe to bash. Commented Aug 14, 2011 at 8:03

Old question, but as of today, comint-clear-buffer (C-c M-o) clears the buffer.

This function should also work for all comint-based buffers (Shell-mode, SQLi-mode, etc...).


Read my comment to John Wiegley, unless you use term clear won't work you can however just to C-x-h which will select all text in buffer and hit delete.

  • 4
    I use M-x erase-buffer to clean up a huge shell buffer.
    – Juancho
    Commented Aug 14, 2011 at 17:04
  • it does the job!
    – 0x0584
    Commented Sep 20, 2020 at 14:52

you can use C-L, it actually does not clear the screen, but moves the whole screen to up, and that make it look like you really cleared the screen


I'm on Hadoop 2.5 and HBase 0.95. You can use system("clear") on hbase shell

You must log in to answer this question.