apmsleep Command in Linux



apmsleep is a command used in Linux systems to set an alarm time in the Real-time-clock (RTC) chip and put your computer into standby or suspend mode. When the specified time arrives, the computer wakes up from sleep.

The apmsleep command is an effective command for those users who want to save the energy consumption of their laptops or desktop computers.

Table of Contents

Syntax of apmsleep Command in Linux

The typical syntax to use the apmsleep command on Linux is provided below −

apmsleep [options]

Here, the apmsleep keyword will invoke the apsleep command and allows you to set an alarm time to put your computer into standby or suspend mode. The [options] are different flags that you can use to work along with the apmsleep command in different ways.

Available Options for apmsleep Command in Linux

Several options can be used with the apsleep command on Linux, these are discussed below −

Options Description
-s or --suspend These options will put your computer into suspend mode by default. You may experience on some laptops that these options may turn off everything on your system.
-S or --standy They will put your computer into the standby mode. On most laptops, it may turn off the screen, CPU, or hard disk.
-w or --wait Wait indefinitely or patiently hold for the specified time to arrive.
-p or --precise Wait for the alarm time to match the actual time on your system. You will need a compatible Kernel and BIOS settings for this option to work on your system. This command will also be useful without the APM.
-n or --noapm Sets the alarm clock and waits indefinitely for a specified time to arrive without calling the APM BIOS to suspend the computer.
-d or --debug Shows the information on the terminal about what is happening during the execution process.

In the apmsleep command, you can specify the wake-up time using two formats, discussed below −

Relative Offset Format

In the relative offset format, you can use +hh:mm time specification. The computer will suspend for exactly hh hours and mm minutes and an additional few seconds to wake up. It takes an additional few seconds because the timing is not completely accurate in some laptops.

Absolute Local Time Format

In the absolute locale time format, you can specify the wake-up time using a 24-hour clock. You simply provide the desired time in the hh:mm format. For example, if you want your system to wake up at 9:30 AM, you must set the time as 08:30. It must be kept in mind that daylight saving time is not considered in this version of apmsleep, however, you may see it in the future release.

Note − It must also be noted that when you suspend the laptop through the apmsleep command, don’t close the laptop lid, because it may overheat when running with the closed lid.

System Requirements for apmsleep Command in Linux

For the apmsleep command to work on your Linux system, ensure the /dev/rtc character device must exist. Further, the Linux kernel should be compiled with APM and RTC support and the computer’s BIOS must have ‘suspend to RAM’ enabled.

Examples of apmsleep Command in Linux

Let’s discuss some examples of apmsleep command on a Linux system −

  • Set an Alarm
  • Suspend the Computer
  • Standby Mode
  • Wait for a Specific Time Leap

Set an Alarm

If you want to set an alarm for a given specified time, use the following syntax −

apmsleep time

For example, to set an alarm for 8:30 AM, use the following command −

apmsleep 08:30

Suspend the Computer

To suspend the computer, let’s say for an hour (60 minutes), run the below-given command −

apmsleep +1.00

Standby Mode

If you want to put your machine into standby mode, for example at 9:00 PM, use the following command −

apmsleep -S 21:00

Wait for a Specific Time Leap

To set an alarm for a specified time, for example, 10:30 PM, and wait indefinitely for the specified time to match the actual time, use the following command.

apmsleep -w 22:30

Conclusion

The apmsleep is a Linux command used to set an alarm time in the Real-time-clock (RTC) chip and put the computers into standby or suspend mode. In this tutorial, we explored the apmsleep command’s syntax and options that you can use with this command.

You should adjust the options according to your specific needs, and use them when required. These options will help you conserve your laptop or computer energy.

Advertisements