linux - 最后|在linux中重新启动会重新启动机器,有人可以解释为什么吗?

标签 linux unix

下面的管道是如何工作的?

last | reboot

上面重新启动了 Linux 机器。

最佳答案

last 搜索最后登录的用户,并将 last 输出提供给 reboot,并且 reboot 将重新启动系统。

last         |          reboot
 |                       |                 => process1 output will be input 
process1               process2                for process2

查看上面所说的man 1 last

Last searches back through the file /var/log/wtmp (or the file desig‐ nated by the -f flag) and displays a list of all users logged in (and out) since that file was created.

正如 Daniel 所说,reboot 并不关心其输入。它可能根本不读取它,因此输入某些内容不会改变它的行为。

关于linux - 最后|在linux中重新启动会重新启动机器,有人可以解释为什么吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49837940/

相关文章:

linux - Catalina.out 未通过 bash 脚本在编辑后登录

linux - 错误 : Package requirements (libprotobuf-c >= 1. 0.1) 未满足

python - 如何在 Linux 上用 python 创建格式良好的 word 文档(.DOC)?

c - proc_dir_entry 警告 : initialization from incompatible pointer type [enabled by default]

linux - 须藤 : pam_authenticate: Conversation error

bash - Unix Bash AIX - 从一个目录查找文件,但不在另一个目录中查找文件

C Minishell - 管道实现需要杀僵尸

linux - Source Insight 中的 ARM 汇编

linux - 如果在 shell 中运行 'exec ls' 会发生什么?为什么?

c - makefile 中检测 rhel 操作系统版本