2

I know that we can shut down windows after some specific time like this

shutdown -s -t <time>

But how can I do the same when I want my pc to sleep after some specific amount of time?? is there any command??

Also it will be helpful if you told me the command for Linux too, Cause i rarely use windows.

  • Are you looking to put the PC to sleep after say, 15 minutes or are you looking to put it to sleep at a particular time (say, 3:30PM) – uSlackr Oct 17 '17 at 19:09
  • 1
    I’m rather puzzled by the close votes.  This question asks how to put the PC to sleep ***after a delay*** for Windows and ideally also for Linux.  That question is about how to put the PC to sleep ***right now*** for Windows only.   Overlap?  Yes.  Duplicate?  No. – G-Man Says 'Reinstate Monica' Oct 18 '17 at 18:18
  • @G-Man the marked answer in the other question mentions the method discussed here. – Burgi Oct 25 '17 at 07:53
  • @Burgi: What are you talking about? I read the linked question last week when I wrote the above comment; I read the *accepted* answer (I assume that’s what you mean by “the marked answer”) again, three times, just now. Yes, it discusses the `rundll32.exe powrprof.dll,SetSuspendState 0,1,0` command, which is mentioned here (and yes, I deliberately switched the verbs), and which answers that question. And, as I said in my comment, the other question is about one-quarter of this question, and so its answer is one-quarter of an answer to this question. So what’s your point? – G-Man Says 'Reinstate Monica' Oct 25 '17 at 16:42

1 Answers1

0

Since you want the Linux solution, on recent systems:

systemctl suspend
systemctl hibernate

If you want this to happen after a delay, combine with the sleep command:

sleep 1h 30m && systemctl suspend

You can also use the kshutdown utility that gives you a GUI to shutdown/sleep on various conditions: after some delay, at a specific time, or when some process terminates.

xenoid
  • 9,782
  • 4
  • 20
  • 31