自定义Linux登录前的欢迎信息
新建文件/etc/profile.d/custom-welcome.sh
touch /etc/profile.d/custom-welcome.sh 文件内容如下
#!/bin/bashecho"========================================="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 下次再进入系统,就会有系统运行情况的打印