2020-02-26
/etc/issue 和 /etc/issue.net 两个文件是在登录之前显示的。前者在本地登录前显示,后者在网络登录前显示。当在TTY控制台登录前 /etc/issue 会被显示, Telnet 登录前则显示 /etc/issue.net。而SSH两者均不显示。/etc/motd 则在成功登陆终端后立即显示。
- man pages 中的描述
man issue
ISSUE(5) Linux Programmer's Manual
NAME
issue - prelogin message and identification file
DESCRIPTION
/etc/issue is a text file which contains a message or system identification to be printed before the login prompt. It may contain various @char and char sequences, if supported by the getty-type program employed on the system.
FILES
/etc/issue
man motd
MOTD(5) Linux Programmer's Manual
NAME
motd - message of the day
DESCRIPTION
The contents of /etc/motd are displayed by login(1) after a successful login but just before it executes the login shell. The abbreviation "motd" stands for "message of the day", and this file has been traditionally used for exactly that (it requires much less disk space than mail to all users).
FILES
/etc/motd
- 实际测试
查看文件的实际内容,Fedora28 中 /etc/issue 和 /etc/issue.net 中的内容是一样的:
S
Kernel
on an m (l)
在后面分别加上它们的文件名。
而 /etc/motd 默认为空,修改其为:
/etc/motd
切换到 tty2 并登陆:
Fedora 28 (Twenty Eight)
Kernel 5.4.6-1.fc28.lemote.mips64el on an mips64 (tty2)
/etc/issue
localhost login:***
Password:
Last login: Wed Feb ...
/etc/motd
[***@localhost ~]$
/etc/motd 可以根据需要修改,作为提示信息等。
- 常用的转义字符
d 本地端时间的日期
l 显示 tty 号码
m 显示硬件等级
显示主机的网络名称
o 显示 domain name
操作系统版本(uname -r)
显示本地端时间的时间(localtime)
s 操作系统的名称(Linux)
S 操作系统信息
v 操作系统版本
by SDUST weilinfox
本文地址:https://www.cnblogs.com/weilinfox/p/12545452.html