原文: https://www.tecmint.com/send-a-message-to-logged-users-in-linux-terminal/

这个需求应该没有那么的大。文章介绍了两种方式。

  1. 使用wall命令

    wall "System will go down for 2 hours maintenance at 13:00 PM"
    或者低版本使用
    echo "System will go down for 2 hours maintenance at 13:00 PM" | wall

  2. 使用wall命令

    如果附加-n参数则不会显示横幅(仅root权限可用)

    echo "System will go down for 2 hours maintenance at 13:00 PM" | sudo wall

  3. 使用write命令

    1. 首先使用who检查哪些用户已登录
    2. 然后使用write命令写入数据

results matching ""

    No results matching ""