How to Disable the “Last Login” Message in Linux Terminal

Every time you open a new terminal window or log into a Linux server via SSH, the system displays a “Last login” message showing the date, time, and IP address of your previous session. While this can be useful for security monitoring on a remote server, it is often unnecessary and visually distracting on a personal desktop computer or a local development environment.

If you want a cleaner terminal experience that drops you straight to the command prompt, you can easily disable the “Last login” message by creating a simple hidden file in your home directory.

How to Hide the Last Login Message Using the .hushlogin File

Linux systems are configured to check for the existence of a specific file named .hushlogin in the user’s home directory. If this file is present, the system will automatically suppress the login messages (including the “Last login” timestamp and the system Message of the Day, or MOTD).

To create this file, follow these steps:

  1. Open your terminal application.
  2. Ensure you are in your home directory by running the command: cd ~
  3. Create the empty file by running the following command: touch .hushlogin

That’s it! The touch command creates an empty file with the specified name. Because the filename begins with a dot (.), it is a hidden file and will not clutter your home directory when you run a standard ls command.

How to Test the Change

To verify that the change worked, simply close your current terminal window and open a new one, or open a new terminal tab. You should now be greeted immediately by your command prompt, without the “Last login” text or any system welcome messages.

How to Re-enable the Login Messages

If you ever decide you want to see the “Last login” timestamp and system messages again, all you need to do is delete the hidden file. Run the following command in your terminal:

rm ~/.hushlogin

The next time you open a terminal or connect via SSH, the standard login information will be displayed as usual.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.