Software & AppsOperating SystemLinux

How To View Ubuntu Login System Information Anytime

Ubuntu 21

In this article, we will explore how to view the Ubuntu login system information anytime you want. This information, which includes system load, memory usage, and available updates, is usually displayed when you log into your Ubuntu system. However, you might want to access this information at other times as well. Here’s how you can do it.

Quick Answer

To view Ubuntu login system information anytime, you can use the cat /etc/motd command to view the static information and the run-parts /etc/update-motd.d/ command (or sudo run-parts /etc/update-motd.d/ if you require root privileges) to view the dynamic information. Alternatively, you can create a script and add it to your ~/.bashrc file to automatically display the login information every time you open a terminal.

Understanding the Message of The Day (MOTD)

Ubuntu uses a system called the Message of The Day (MOTD) to display system information at login. The MOTD consists of static and dynamic information.

  • Static information: This is stored in the /etc/motd file and remains the same until manually changed.
  • Dynamic information: This is generated by scripts located in the /etc/update-motd.d/ directory and can change every time you log in.

Viewing Static Information

To view the static information, you can use the cat command, which reads files sequentially, writing them to the standard output. Here’s how to do it:

  1. Open a terminal window. You can do this by pressing Ctrl + Alt + T or by searching for ‘terminal’ in the application menu.
  2. In the terminal, type the following command and press Enter:
    cat /etc/motd

This command will display the contents of the /etc/motd file, which is the static information displayed at login.

Viewing Dynamic Information

To view the dynamic information, you can use the run-parts command, which runs all the scripts located in a specific directory. Here’s how to do it:

  1. In the terminal, type the following command and press Enter:
    run-parts /etc/update-motd.d/

This command will execute all the scripts in the /etc/update-motd.d/ directory, which generate the dynamic information displayed at login.

Note: Running this command may require root privileges, so you may need to use sudo:

sudo run-parts /etc/update-motd.d/

Viewing Login Information Anytime

If you want to view the login information anytime you open a terminal, you can create a script that combines the commands mentioned above and add it to your ~/.bashrc file. Here’s how to do it:

  1. Open a terminal window.
  2. Run the following command to create a script file:
    nano ~/motd.sh
  3. In the nano editor, enter the following lines:
    #!/bin/bash
    cat /etc/motd
    run-parts /etc/update-motd.d/
  4. Press Ctrl + X to exit nano, then press Y to save the file.
  5. Make the script executable by running the following command:
    chmod +x ~/motd.sh
  6. Open your ~/.bashrc file for editing:
    nano ~/.bashrc
  7. Scroll to the end of the file and add the following line:
    ~/motd.sh
  8. Press Ctrl + X to exit nano, then press Y to save the file.

Now, every time you open a terminal, the script motd.sh will be executed, displaying the static and dynamic information similar to what you see at login.

Conclusion

By following the steps mentioned in this article, you can easily view the Ubuntu login system information anytime you want. This can be particularly useful if you need to keep track of system load, memory usage, or available updates. Remember, the specific commands and paths may vary depending on your Ubuntu version. Always refer to the official Ubuntu documentation for the most accurate information.

How can I access the Ubuntu login system information?

To access the Ubuntu login system information, you can use the cat /etc/motd command to view the static information stored in the /etc/motd file, and the run-parts /etc/update-motd.d/ command to view the dynamic information generated by scripts in the /etc/update-motd.d/ directory.

Can I view the login system information anytime I open a terminal?

Yes, you can create a script that combines the commands mentioned above (cat /etc/motd and run-parts /etc/update-motd.d/) and add it to your ~/.bashrc file. This way, the script will be executed every time you open a terminal, displaying the login system information.

Leave a Comment

Your email address will not be published. Required fields are marked *