Remove the “Last login” Message from the Terminal
When you launch a new Terminal window or tab in Mac OS X (and most linux distributions) you’ll be greeted with a little message, either some “last login” details, or maybe even a message from the admin from /etc/motd. The last login details are default in a new Mac OS X terminal session, whereas the Message Of The Day is from a custom adjustment set by the sysadmin or yourself.
If you’d like to change or remove that “Last Login” message, you can do so rather easily by turning to the command line and creating a modifier file. This will override whatever the login message is in Terminal app, effectively disabling it for the user account where it’s put in place.
To be clear, with the default Last Login message on the Mac, the screen output typically looks something like this when you launch a new window:
Last login: Tue Jun 22 10:59:29 on ttys003
Macintosh:~ user$
How to Disable the “Last Login” / MOTD on New Terminal Session on Mac
If you don’t want to see that login message or MOTD again, you can get rid of that ‘Last login’ message at the top of a new terminal by entering the following command to create a ‘hushlogin’ file:
touch .hushlogin
Generally you’ll want to put that file into a users home directory. The existence of the file is enough to silence the MOTD and login message.
Now when you launch a new terminal you won’t see the message, changes take effect immediately.
Note that having a .hushlogin file in the users home directory will also mute the /etc/motd file from executing. If you’re having problems with that executing, just proceed the file with a directive:
touch ~/.hushlogin
If you’re a root user you can create the files into other user directories as well:
touch /Users/NAME/.hushlogin
Recall that the ‘touch’ command creates a blank file of the provided name.
If you want to reverse this and get the last login or MOTD back again, all you have to do is remove the ‘touched’ .hushlogin file, by entering the following command:
rm .hushlogin
If you want to, you can create a custom MOTD with whatever message you want that will be displayed instead. That can literally be anything, from a simple hello, to a to-do list, to calendars, ASCII art, to many other things. Many systems administrators have fun with the MOTD file, and you can too. You can even use scripts to provide randomized quotes or advice for the motd as well, though that’s a topic for another article.
Have anything fun or interesting in your MOTD? Let us know in the comments!
Works for me, on newest versions of macOS
It’ll ask for your password since this is changing the terminal.
Thanks for this amazing article, now I know where to enter the following command. If you are going to write an article then write it just like this, it’s that helpful. Now my MOTD has changed, awesome, I am a terminal expert.
it only works for new windows.
is there a way to make it work for new tabs too?
Good trick but you better use:
touch ~/.hushlogin
and
rm ~/.hushlogin
Cheers