新建文件 /etc/profile.d/custom-welcome.sh
touch /etc/profile.d/custom-welcome.sh
文件内容如下:
#!/bin/bash
echo "========================================="
echo "Welcome to $(hostname)!"
echo "System uptime: $(uptime -p)"
echo "Memory usage: $(free -h | awk 'NR==2 {print $3 \"/\" $2}')"
echo "Disk space: $(df -h / | awk 'NR==2 {print $3 \"/\" $2, \"(\" $5 \")\")}"
echo "========================================="
保存退出后,授权执行权限:
chmod +x /etc/profile.d/custom-welcome.sh
下次进入系统时,将显示系统运行情况的打印信息。


