Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I connect to my SSH server, it prompts me for the user name and password. After I have authenticated, it will display my MOTD, then show user prompt, like this:

Using username "root".
Authenticating with public key "everssh"
this is my motd

I want to edit some file so that the screen is cleared before the MOTD prints (so basically calling the clear command would do). I heard that the MOTD is displayed by using cat /etc/motd in a startup file, however after searching around I can't find where it is called from.

Does anyone know how I can find it?

share|improve this question
up vote 1 down vote accepted

The motd is indeed taken from the /etc/motd file, but it is not displayed using cat or any other external command: the SSH server does it internally, using the pam_motd PAM module.

If you want the screen to be cleared when the motd is displayed (wouldn't it be annoying, though?), you add use the ANSI sequences ESC [ H and ESC [ J to the beginning of /etc/motd contents.

  • To insert the ESC character in Vim, press Ctrl+V, Esc; in Nano, press Alt+V, Esc.

  • Insert [ and H using [ and Shift+H.

  • Repeat to insert ESC [ J.

share|improve this answer
Wasn't totally clear to me at first, but the line should look like this in the editor: "^[[H^[[J". +1 for a good answer. – CHK Jul 10 '15 at 16:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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