This is a custom welcome message script for Nushell, designed to replace the default startup banner and provide an information-rich dashboard about the system’s status each time the shell starts.
Features Overview#
- System Information: Displays the hostname, kernel version, and the current logged-in user.
- Last Login: Shows the user information, source IP, and time of the last login to the system.
- Resource Status:
- CPU: Displays the CPU model and the real-time 1-minute, 5-minute, and 15-minute system load averages.
- Memory: Shows used and total memory in GB, along with the usage percentage.
- Disk: Shows used and total disk space in GB, along with the usage percentage.
- Container Status:
- Podman Containers: Summarizes the total number of discovered containers, as well as the number of running and exited containers.
- Podman Pods: Summarizes the total number of discovered pods and the number of currently running pods.
- Security Status:
- Fail2ban: Presents four key metrics for Jails in a table: “Current failed,” “Total failed,” “Current banned,” and “Total banned.”
Dependencies#
- Core Utilities:
uname
,last
,df
(these are fundamental components of all modern Linux distributions). - Optional Utilities:
podman
: If it is not installed or the service is not running, the relevant section will display a friendly warning message.fail2ban-client
: If it is not installed, the relevant section will display a warning.sudo
: To allow a non-root
user to query the Fail2ban status, asudo
rule must be pre-configured.
Installation#
- Back up your old configuration: Before making any changes, please back up your existing
config.nu
file.1cp ~/.config/nushell/config.nu ~/.config/nushell/config.nu.bak
- Replace the configuration: Copy the complete code below and entirely replace the contents of your
~/.config/nushell/config.nu
file with it. - (Optional, Not Recommended) Configure Sudo for Fail2ban: To allow a non-
root
user to see the Fail2ban status, use thesudo visudo
command to add the following rule at the end of the file (please replaceyour_username
with your actual username):1your_username ALL=(ALL) NOPASSWD: /usr/bin/fail2ban-client status
- Restart Nushell: Close and reopen your terminal to see the new custom welcome screen.