A lightweight, high-performance C++ wrapper for Linux shutdown and reboot commands.
Featuring a real-time Terminal UI, interactive safety buttons, and inhibitor awareness.
- 🎯 High-Precision Timing: Uses the C++
std::chrono::steady_clockto prevent clock drift. Stay accurate even under high CPU load. - 🛡️ Universal Inhibitor Awareness:
- Systemd Systems: Queries
systemd-inhibitto identify exactly which app is blocking shutdown. - Non-Systemd Systems: Fallback to a process watchlist (
pgrep) to protect active tasks on Artix, Void, or Gentoo.
- Systemd Systems: Queries
- 🎮 Interactive TUI: Switch between "Act Now" and "Cancel" using Arrow Keys, Tab, or Space.
- 🚨 Safety First: Critical inhibitors trigger an immediate program termination to prevent "ghost" shutdown attempts.
- 📦 Zero Dependencies: Pure C++11. No
ncursesor external libraries required.
Clone the repository and compile the source code using g++:
git clone https://github.com/adilhaimoura/PowerTUI.git
cd PowerTUI
g++ shutd.cpp -o shutd
Move the binary to your local bin folder to run it from anywhere:
sudo mv shutd /usr/local/bin/
sudo chmod +x /usr/local/bin/shutd
Run a standard 1-minute shutdown countdown:
shutd
Command
Description
shutd
Schedules a shutdown in 1 minute (default).
shutd -r <min>
Schedules a reboot in <min> minutes.
shutd -h <min>
Schedules a shutdown in <min> minutes.
Examples:
# Reboot in 10 minutes
shutd -r 10
# Shutdown in 5 minutes
shutd -h 5
The interface is designed for quick keyboard interaction.
Key
Action
Tab / Arrows
Toggle between Action and Cancel.
Enter
Confirm selection.
C or Ctrl+C
Immediate Abort.
Standard shutdown +m commands are "set and forget," often leading to lost work if you forget a timer is running in the background.
PowerTUI solves this by staying in your terminal, providing constant visual feedback. If a background process (like a large download, a render, or a media player) is inhibiting shutdown, PowerTUI will detect it and alert you before the final execution, ensuring you never lose unsaved work accidentally.
Distributed under the MIT License. See LICENSE for more information.