How to hibernate or suspend using commands in the terminal

From the terminal you can do everything, in this case I will show how to know if your computer supports entering sleep or hibernation mode, and if it can how to do it.

To know if your computer can suspend and / or hibernate, we must read what is in the / sys / power / state file

cat /sys/power/state

If "mem" appears in the results, it means that we can suspend the computer. If "disk" appears it means that we can hibernate.

Both to suspend and to hibernate we need administrative privileges, so we must either execute the commands as root or with sudo.

Lay off:

To suspend we will use pm-suspend

sudo pm-suspend

Hibernate:

To hibernate we will use pm-hibernate

sudo pm-hibernate

Sleep and Hibernate at the same time:

If your computer supports both, that is, suspend and hibernate, you can use a hybrid of both.

sudo pm-suspend-hybrid

What does this allow?

This is a suspension like the first command I showed you, but in addition to suspending, a system image is saved, that is, suspend + hibernate.

Let me explain better, if they leave the laptop in suspension and they are left with 0% battery when starting the laptop, the system would start in white, while with this command in theory, it suspends the system but if we run out of power when starting the laptop we will not have lost anything, because the image that was saved when suspending will be used + hibernate

The end!

Well, I hope you found it interesting.

regards


28 comments, leave yours

Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   RoyalGNZ said

    I get «mem disk» 😀

    1.    KZKG ^ Gaara said

      Then you can suspend and hibernate 🙂

  2.   Ricardo Parraga said

    Let's see in my system:

    root @ debian: ~ # cat / sys / power / state
    freeze memory disk

    root @ debian: ~ # pm-
    pm-hibernate pm-is-supported pm-powersave pm-suspend pm-suspend-hybrid

    In my system, what I use is the 'hibernate' program, having known that it already had tools.

    Thanks for the Tip.

  3.   Erick said

    @ proxy server: ~ $ cat / sys / power / state
    freeze memory disk

    Very good, so now I will use sudo pm-suspend-hybrid, for more security, Regards

  4.   RAW-Basic said

    Sandy, do a review of the post .. ..it has a lot of repeated text .. not stable ..

    1.    KZKG ^ Gaara said

      Ready, thank you very much. I don't know where my head is lately… ^ - ^ U

  5.   poor taku said

    I have used these commands for a long time, in addition to init 0, poweroff or shutdown -h now because for unknown reasons the gnome takes a minute to react to these commands

  6.   st0rmt4il said

    Added to favorites.

    Thanks man ;)!

  7.   vidagnu said

    Thanks for the info!

  8.   miniminime said

    Regards,

    Thanks for sharing the tip, I just saw it and remembered that I was looking for a long time, now I just need to find how to copy the clipboard by console.

    Thanks for the contribution and great blog 😉

    1.    KZKG ^ Gaara said

      For nothing, a pleasure.
      About the clipboard, check here if there is something that works for you: https://blog.desdelinux.net/tag/clipboard/

    2.    poor taku said

      I think they had put an article here on that, just in case xclip helps you get from the console to applications, in debian it is in the repository.

  9.   Germaine said

    Thank you very much, my computer is compatible to suspend and hibernate, I use Kubuntu 14.04 (64) and I already added it to do the process.

  10.   William said

    Hi all!

    With the command:
    cat / sys / power / state

    I get:
    freeze memory disk

    and I was able to do the tests indicated in this article, but I have a password enabled to start the system and after returning from suspension and hibernation using the Terminal with the commands:
    sudo pm, the system starts where it was without asking for the password, and that is strange because if I suspend in the usual way using the graphical interface, when it comes back from suspension it always asks me for the password.

  11.   Elm Axayacatl said

    Thanks for the commands, but how to return from sleep or hibernation? My laptop is left with the screen black and on, and nothing I press takes me back to the system, so I have to force it off.

  12.   andres said

    I wrote the command cat / sys / power / state
    I got the following: freeze mem disk
    typing sudo pm-suspend suspends the pc
    typing sudo pm-hibernate shuts down the screen for a second and then returns to normal. Before having Ubuntu 14.04 I had Windows 8.1 and I could hibernate the computer, what do you think is my problem?

    1.    Cristobal said

      The same happens to me. According to this article it should be able to hibernate but I don't know why it doesn't work.

      By using the command:
      cat / sys / power / state

      the answer is:
      freeze memory disk

      I use Ubuntu 14.04, but I also have Windows on this PC. Ubuntu's partition is 4GB ext20 and SWAP is 6,0GB, equal to the size of RAM (from what I understood to hibernate SWAP is used). I don't know if a bigger partition is necessary or if I am missing something else. Hopefully someone can help me.

  13.   Miguel said

    Thank you, your tutorial helped me a lot, I am new to the Linux environment and with it I want to exploit what I did not do in Windows. Just an observation, and how do I get back to taking control of my lap?

  14.   Miguel said

    uuups, I already saw in the comments how to recover the state of the lap, thank you very much

  15.   Juan Carlos said

    My laptop supports many options, I already tried them in the console and everything. Ok, my question is, how do I add these options in Gnome? Since the system only gives me the option to Shut Down and Block, the latter only turns off the monitor and locks the session, but it remains on.

    I want it to be suspended when closing the lid of the laptop so that I can move it more comfortably, but I don't have those options, in the Power option it appears disabled.

    Greetings.

  16.   xXLEMXx said

    it tells me standby mem disk

  17.   sildar said

    Thank you very much for sharing this, I threw "freeze standby mem disk", the other two words will matter of anything?

  18.   Jesus Hernandez Garcia said

    Do you know if there is any way I can turn off the screen? I have been using the xset but the screen remains black and does not turn off at all .. It would be to be able to turn off a screen from the mobile with a raspberry pi2 by ssh .. Thank you very much and congratulations for the tutorial 🙂

  19.   abdiel said

    How can I remove the option to hibernate. Since I activate it, the battery lasts very little. I attribute it to this… it helps !!!

  20.   ... said

    Thanks for the tutorial usemoslinux.

  21.   mich said

    Thanks, it worked perfectly! Let's use Linux Ubuntu

  22.   Osvaldo Delgado placeholder image said

    Men, sorry I tried it but it didn't work for me with version 16.04. Greetings and thank you very much

  23.   laleta said

    Not working !

    sudo: pm-hibernate: command not found

    sudo: pm-suspend-hybrid: command not found

    solution:

    sudo apt-get install pm-utils

    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

    done!

    https://command–not–found-com.translate.goog/pm-suspend-hybrid?_x_tr_sl=en&_x_tr_tl=es&_x_tr_hl=es-419&_x_tr_pto=sc