Step 1: Click the Settings icon to access Settings by heading to Activities Overview, typing settings into the search bar, and then click on it.
Step 2: After opening the Settings window, select "Power" from the list on the left and the Power panel will appear on the right side of the screen.
Step 3: Select Automatic Suspend from the "Suspend & Power Button" menu.
Step 4: Choose "Plugged In" or "On Battery Power," turn the switch on, and choose the delay time. Both options allow for customization:
"On Battery Power" was activated, and I set the delayed time to 20 minutes. You can adjust your settings as necessary. In other words, if your laptop is running on battery power, it will shut down after 20 minutes. Additionally, you can configure Plugged In mode.
Method 2: How to Put a PC to Sleep Mode using Terminal
There aren't any direct ways to change sleep settings in the terminal, but there are a few ways to pause all activity on your Ubuntu computer or put it in hibernation mode:
Put your system on hold: To suspend your system, first open the terminal and enter the following command:
Your system will be suspended and a black screen will appear after running the aforementioned command.
Sleep your system: In order to put your machine into hibernation, type the following command that is being mentioned below:
$ systemctl hibernate
Your computer automatically enters sleep mode when it is not in use after a predetermined amount of time. In this article, we described simple methods for changing the sleep settings in your Linux operating system (Ubuntu). One method is through the power settings, and the other is using the terminal approach. Additionally, you can write unique scripts to change your sleep settings.