Keep your computer awake effortlessly with Keep-Alive! This lightweight tool prevents your system from sleeping, ideal for long downloads, continuous processes, or simply maintaining system activity. Compatible with Linux, macOS, and Windows, Keep-Alive offers a hassle-free solution.
Table of Contents
Keep-Alive is a compact program designed to prevent your computer from entering sleep mode. Perfect for:
Its simplicity and cross-platform compatibility make it a versatile choice.
Keep-Alive employs OS-specific methods to maintain system wakefulness:
Linux: Utilizes systemd-inhibit (preferred) or xset commands/GNOME settings if systemd is unavailable.
macOS: Leverages the caffeinate
command to prevent sleep across various system components (display, disk). It also simulates user activity.
Windows: Employs the SetThreadExecutionState
API, with a PowerShell fallback for enhanced reliability.
curl -LO https://github.com/stigoleg/keep-alive/releases/latest/download/keep-alive_Linux_x86_64.tar.gz
tar xzf keep-alive_*_x86_64.tar.gz
sudo mv keepalive /usr/local/bin/
Prerequisites (Linux): systemd (recommended) or X11, a TUI-compatible terminal, and Go 1.21 or later.
git clone https://github.com/stigoleg/keep-alive.git cd keep-alive
go build -o keepalive ./cmd/keepalive
Use the -d
flag to specify wake duration:
keepalive -d 2h30m // Keeps the system awake for 2 hours and 30 minutes.
Version check: keepalive -v
Help: keepalive -h
Run keepalive
without flags for a menu-driven experience. Use arrow keys (or j/k) to navigate and Enter to select. Press q or Esc to exit.
Keep-Alive is a valuable tool for maintaining system wakefulness during essential tasks. Its ease of use and cross-platform compatibility make it a practical solution for preventing unexpected system sleep.
Resources:
Further Reading:
The above is the detailed content of How To Keep Your Linux System Awake With Keep-Alive. For more information, please follow other related articles on the PHP Chinese website!