如何随时查看 Ubuntu 登录时显示的详细信息?

如何随时查看 Ubuntu 登录时显示的详细信息?

当我登录到我的 ubuntu 系统时,它向我显示了这条消息,我怎样才能随时看到它?我尝试运行. .bashrc但没有成功。

Welcome to Ubuntu 12.10 LTS (GNU/Linux 3.2.0-24-virtual x86_64)

 * Documentation:  https://help.ubuntu.com/

  System information as of Sat Jul 13 06:16:35 UTC 2013

  System load:  0.55              Processes:           96
  Usage of /:   8.1% of 68.74GB   Users logged in:     0
  Memory usage: 55%               IP address for eth0: 198.xx.xxx.xxx
  Swap usage:   0%                IP address for eth1: xxx.1x0.xx.xxx

  => There is 1 zombie process.

  Graph this data and manage this system at https://landscape.canonical.com/

223 packages can be updated.
134 updates are security updates.

Last login: Mon Jul  8 17:47:05 2013 

答案1

看起来已经变了。Ubuntu 16.04 没有这个选项,/etc/motd但你可以cat /var/run/motd.dynamic改用这个。

答案2

正如多次提到的,下面的脚本/etc/update-motd.d提供了登录时显示的典型输出;请参阅update-motd(5)。但是,几乎不需要重新发明轮子,只需自己编写脚本来依次运行每个脚本即可重新创建所需的功能。请使用run-parts(8)专为此目的提供的脚本:

sudo run-parts /etc/update-motd.d

这类似于pam_motd(8)PAM 模块所做的,在用户身份验证之后、打开用户登录 shell 之前以 root 身份运行。

请注意,它run-parts本身不需要特殊权限;但是,update-motd通常有一个或多个脚本需要这些权限。因此,除非您处于 root shell 中,否则在运行此命令时不要关闭sudo,否则您可能会看到显示的错误和过时的系统信息。

[2022-09-24:为清晰起见,进行了自我编辑。--RichieD]

答案3

您可以随时显示此消息 -信息oFd哎呀- 在终端中使用下一个命令:

cat /etc/motd

或更好:

for i in /etc/update-motd.d/*; do if [ "$i" != "/etc/update-motd.d/98-fsck-at-reboot" ]; then $i; fi; done

如果您希望每次打开终端时都看到此消息,只需在文件末尾插入上述行之一~/.bashrc(您可以使用gedit ~/.bashrc命令打开它)。

/etc/mod 命令是类 Unix 系统上的一个文件,其中包含“每日消息”,用于向所有用户发送通用消息,其效率比向所有用户发送电子邮件消息更高。

更多关于:http://en.wikipedia.org/wiki/Motd_(Unix)

有关的:/etc/motd 如何更新?

答案4

如果您希望刷新并显示 motd,请尝试:

run-parts /etc/update-motd.d/

相关内容