有没有办法杀死所有应用程序并从终端重新启动 Mac?
Is there a way to kill all applications and restart the Mac from the terminal?
终端中是否有代码 运行 可用于关闭所有应用程序并重新启动 mac?我目前正在使用 "osascript -e 'tell app \"System Events\"to restart" 来重启,但它并没有关闭应用程序。 - 我需要所有代码都在一个命令中,这样我就可以把它放在我的代码中,而不会一个取消另一个。
shutdown
将为您自动关闭应用程序(但它们可能不会保存其工作文件):
关机:
$ sudo shutdown -s now
重启:
$ sudo shutdown -r now
终端中是否有代码 运行 可用于关闭所有应用程序并重新启动 mac?我目前正在使用 "osascript -e 'tell app \"System Events\"to restart" 来重启,但它并没有关闭应用程序。 - 我需要所有代码都在一个命令中,这样我就可以把它放在我的代码中,而不会一个取消另一个。
shutdown
将为您自动关闭应用程序(但它们可能不会保存其工作文件):
关机:
$ sudo shutdown -s now
重启:
$ sudo shutdown -r now