为什么要写这个?
单纯想记录
存放位置
cd /etc/update-motd.d
输入这行命令进入到Ubuntu欢迎界面配置存放的位置
默认
下面是默认的欢迎界面
每个版本的欢迎信息可能都会不太一样,例如我的是 Ubuntu 22.04.2 LTS
这里面很多的信息都不太重要,所以我会选择将它们都不显示,最后的效果长这样
看着简洁多了,而且还加入了一些自己的文案。
修改
当在 /etc/update-motd.d/的目录下时,输入ls显示所有的目录信息。
这些脚本的执行顺序是按照文件名前面的序号进行依次执行的,所以我们就可以简单修改一下里面的内容。
00-header
#!/bin/sh
#
# 00-header - create the header of the MOTD
# Copyright (C) 2009-2010 Canonical Ltd.
#
# Authors: Dustin Kirkland <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
exportTERM=xterm
/usr/bin/clear
[ -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""$DISTRIB_DESCRIPTION""$(uname -o)""$(uname -r)""$(uname -m)"
10-help-text
#!/bin/sh
#
# 10-help-text - print the help text associated with the distro
# Copyright (C) 2009-2010 Canonical Ltd.
#
# Authors: Dustin Kirkland <[email protected]>,
# Brian Murray <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# printf "\n"
# printf " * Documentation: https://help.ubuntu.com\n"
# printf " * Management: https://landscape.canonical.com\n"
# printf " * Support: https://ubuntu.com/advantage\n"
88-esm-announce
#!/bin/sh
# stamp="/var/lib/ubuntu-advantage/messages/motd-esm-announce"
# [ ! -r "$stamp" ] || cat "$stamp"
97-overlayroot
#!/bin/sh
(egrep "overlayroot|/media/root-ro|/media/root-rw" /proc/mounts 2>/dev/null | sort-r) || true
echo"If you don't donate, you will succeed!"
printf "\n"