Simple question. I see the following when I open a new terminal window (iTerm):

Last login: Fri Mar  2 16:52:40 on ttys009

I am working on some desktop automation (terminal shortcuts n such) and want to make that text go away when opening a new virtual terminal in an interactive session. I am using bash as my login shell.

Is this a bash setting? How can I silence this output?

  • It would help if you could explain what you mean by "terminal shortcuts" here, and have you worked out where that output is coming from? Usually these things are in a file like .bashrc or .bash_profile, so it's likely you could just comment out the command ... Mar 3, 2018 at 4:16

3 Answers 3


From man login:

If the file ~/.hushlogin or /etc/hushlogins exists, then a "quiet" login is performed (this disables the checking of mail and the printing of the last login time and message of the day).

Note that if last login is still being shown after carrying out the above, you should investigate PAM as suggested in the man page.

  • This switches off everything. How to just disable the “latest login” message? May 5, 2021 at 6:27
  • If you were to read the man page you would notice that it prints the last login info if the file /var/log/lastlogs exists. This implies that if the file doesn't exists....? However, I'd be wary as removing that file may break something else. Might be worth a test though? May 5, 2021 at 7:13
  • “man login” on Ubuntu does not give that info. However, other sources tell that echo > /var/log/lastlog should help and indeed this suppresses the message. Even better may be unix.stackexchange.com/a/170564/78728. May 5, 2021 at 12:20
  • Now that you've mentioned it - it doesn't show up on my Debian boxes neither. However, it does if you type man login into Google although that's a generic result, not a distro specific one. Must check my sources in future! May 5, 2021 at 14:21

If you're working on automation, it should not matter -- that text is not displayed for non-interactive terminals.

  • Workstation automation - I should have been more clear. I do see it. I'll edit post.
    – 111---
    Mar 2, 2018 at 22:03

Or a good old clear does the job

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .