Yes—you can schedule a computer to sleep or wake from a terminal, but the commands depend on your operating system and whether you mean suspending the computer or turning its display off. On Linux and macOS, built-in tools can schedule sleep or request a timed wake; Windows offers command-line options for sleep and scheduled wake tasks, subject to hardware and power settings.
What “sleep” and “wake” mean
Sleep is a low-power state that keeps a session available to resume. A sleeping computer is not necessarily fully off, and it may still use some power. Hibernation saves the session to storage and powers down more completely; shutdown closes the session instead. “Turn off the screen” is different from putting the whole computer to sleep.
Wake scheduling has an extra complication: an operating system can request a wake, but it cannot always make one happen. Firmware, hardware, battery state, network settings, and operating-system power policies can affect whether a timer works. A machine that is shut down may not support the same wake method as one that is sleeping.
Linux: schedule sleep or a timed wake
On many Linux systems using systemd, the systemctl command can request a sleep state. For example, this suspends the computer after a 30-minute delay:
sleep 30m; systemctl suspend
The shell’s sleep command waits; it does not itself put the computer to sleep. When the delay ends, systemctl suspend requests suspension. The command may need administrator privileges, depending on system configuration. To hibernate instead, use systemctl hibernate, if hibernation is supported and configured.
To request a wake at a specified time, systemd provides rtcwake on systems with a supported real-time clock alarm. For example, to suspend and request a wake in 45 minutes:
sudo rtcwake -m mem -s 2700
Here, -m mem selects suspend-to-RAM and -s 2700 sets the delay in seconds. The RTC alarm and the computer’s firmware must support the request. Check the local manual with man rtcwake; available modes and behavior vary. A command that works on one Linux computer may fail or wake only from certain sleep states on another.
For a persistent schedule, use a systemd timer or another scheduler rather than leaving a terminal command running. A timer can launch a service at a chosen calendar time, but the computer generally has to be awake for the timer to run. Scheduling a service is not the same as configuring a hardware wake alarm.
macOS: use pmset for timed power events
macOS includes the pmset power-management utility. To schedule a one-time sleep event, an administrator can use a command such as:
sudo pmset schedule sleep "11/06/26 23:30:00"
To request a wake event, use the corresponding event type:
sudo pmset schedule wake "11/07/26 07:00:00"
These examples use a date and time; confirm the accepted date format on the Mac with man pmset, since details can depend on the system’s locale and software. The date must be in the future. You can inspect scheduled power events with pmset -g sched, and remove scheduled events with sudo pmset schedule cancelall.
A scheduled wake is not a guarantee that a Mac will power on from every state. Apple’s power-management behavior varies by model and configuration; a sleeping Mac may wake for a scheduled event, while a shut-down computer may not. Check the Mac’s power settings and the pmset manual before relying on a schedule.
Windows: sleep commands and wake timers
Windows does not provide one universal built-in command that means “sleep in 30 minutes” on every installation. A common approach is to use PowerShell to wait and then call the Windows API, or use a scheduled task that starts a sleep command. For an immediate sleep request, some systems accept:
rundll32.exe powrprof.dll,SetSuspendState 0,1,0
Its behavior can be affected by hibernation settings, and it is not a dependable substitute for checking the machine’s configured sleep state. Test it when you can safely resume the session. Windows’ shutdown command schedules shutdown or restart, not a general timed sleep; do not confuse shutdown /s with sleep.
To arrange a wake, create a scheduled task in Task Scheduler, set a trigger for the desired time, and enable the option to wake the computer to run the task. The task’s action must do something that leaves the computer awake, or the machine may immediately return to sleep. Wake timers also need to be allowed in the active power plan, and firmware must support waking from the current sleep state. Command-line tools such as powercfg can help inspect configuration; run powercfg /waketimers to see active wake timers and powercfg /lastwake to inspect the last reported wake source.
Choose a method that fits the schedule
- One-time delay: use a shell delay followed by a sleep command, while keeping the session or scheduled process alive.
- One-time wake: use a supported RTC alarm on Linux or a scheduled power event on macOS; on Windows, configure a wake-enabled scheduled task and power settings.
- Repeated schedule: use a system scheduler or built-in task scheduler. Confirm whether it must wake the computer or merely run while the computer is already on.
- Display only: choose a display-sleep setting or command rather than suspending the entire machine.
Use local time carefully. A schedule may be interpreted using the computer’s time zone and clock, and daylight-saving changes can affect calendar-based events. Relative delays, such as “in 45 minutes,” avoid some calendar-entry mistakes but still depend on the computer and its power system behaving as expected.
Common problems and safe testing
If a command reports permission or authorization errors, check whether it requires administrator access and whether the desktop’s power-management service controls sleep. On Linux, inspect the command’s manual and system logs. On Windows, verify that the scheduled task is enabled, its trigger is correct, and wake timers are allowed. On macOS, list scheduled events with pmset -g sched.
If the computer sleeps but does not wake, check whether it entered the expected sleep state, whether the wake alarm remains scheduled, and whether firmware or operating-system settings permit wake timers. USB devices, network wake settings, and battery-saving policies can also affect behavior. A laptop may not wake as expected when its lid is closed or its battery is depleted.
Test with a short delay while you are present, save open work, and avoid depending on a scheduled wake for an urgent task. A command can request a transition; it cannot guarantee that every computer will honor it. For recurring schedules, verify that the schedule survives a reboot and that it does not conflict with updates or other power policies.
Frequently Asked Questions
Can I wake a computer that is completely shut down?
Sometimes, but not universally. Wake-on-LAN or firmware alarms may support particular systems, while many scheduled wake methods work only from a sleep state. Check the computer’s firmware and operating-system documentation.
Does sleep 30 put my computer to sleep?
No. In a shell, sleep 30 pauses that process for 30 seconds. You must follow it with a command that requests system sleep.
Will a terminal command still run after I close the terminal?
Usually, a foreground command may stop when its terminal session ends. Use a persistent scheduler or a properly detached process if the schedule must outlast the terminal, and verify how your system handles it.
Can I schedule sleep at the same time every day?
Yes, with a recurring system timer, scheduled task, or supported power-management schedule. Configure the recurrence in the relevant tool and check that wake requirements and time-zone behavior are understood.
Why does my computer wake immediately after sleeping?
A wake timer, device, network event, or system task may be triggering it. Check the operating system’s reported wake source and active timers, then review device and power settings rather than repeatedly forcing sleep.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
More cards in this drawer
- Delete Picture Kik? How to Remove Photos
- Data Breaches That Shook the World
- Disable Google Assistant: Turn It Off on Android & Home
- Resin vs FDM Printers for Miniatures: Detail, Durability, Cost
- Are Networked Implants Safe? What If One Fails?
- How to Stop WordPress Comment Spam: A Layered Guide