您的位置:首页 > 运维架构 > Shell

修改linux shell登陆欢迎信息

2015-06-17 22:47 531 查看
Ubuntu欢迎信息保存在/etc/update-motd.d/,修改其中的文件即可修改欢迎信息
~# ls /etc/update-motd.d/

00-header  10-help-text  90-updates-available  91-release-upgrade  98-fsck-at-reboot  98-reboot-required

修改相应文件后,执行
~# run-parts /etc/update-motd.d/

生效
默认欢迎信息:
Welcome to Ubuntu 14.04 LTS (GNU/Linux 3.13.0-24-generic x86_64)

* Documentation:  https://help.ubuntu.com/ 
260 packages can be updated.

130 updates are security updates.

You have new mail.

Last login: Wed Jun 17 22:21:45 2015 from service

例如修改00-header:
[ -r /etc/lsb-release ] && . /etc/lsb-release

if [ -z "$DISTRIB_DESCRIPTION" ] && [ -x /usr/bin/lsb_release ]; then

# Fall back to using the very slow lsb_release utility

DISTRIB_DESCRIPTION=$(lsb_release -s -d)

fi

printf "Welcome to %s (%s %s %s)\n" "My OS" "$(uname -o)" "$(uname -r)" "$(uname -m)"

cat /etc/kylin

然后新建文件/etc/kylin:
,.
-|` .*)
-!:?);?:
-,):???????"
-"????????????,
,????????????:!`                  -||
`*????????????"-                 `(*:;;
,;???????????????"(.`           `(?????"
`(??????????????????;:*(,.` -')*"*())(,`
(????????????????????????;??,-
*??????????????????????????
.?????;;???;")!.` .*???????(
!???(` `-`      .)??"!*????*
`!??'         .(:?;,`  !??:).
.???`         .?!!.`  .???>

然后执行:run-parts /etc/update-motd.d/,效果:
Welcome to My OS (GNU/Linux 3.13.0-24-generic x86_64)

,.
-|` .*)
-!:?);?:
-,):???????"
-"????????????,
,????????????:!`                  -||
`*????????????"-                 `(*:;;
,;???????????????"(.`           `(?????"
`(??????????????????;:*(,.` -')*"*())(,`
(????????????????????????;??,-
*??????????????????????????
.?????;;???;")!.` .*???????(
!???(` `-`      .)??"!*????*
`!??'         .(:?;,`  !??:).
.???`         .?!!.`  .???>

* Documentation:  https://help.ubuntu.com/ 
You have new mail.
Last login: Wed Jun 17 22:24:35 2015 from 192.168.7.2
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: