How to detect if computer is asleep
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO9GURib1T8z7lCwjOGLQaGtrueEthgQ8LO42ZX8cOfTqDK4jvDDpKkLFwf2J49kYCMNW7d4ABih_XCb_2UXdq5fPJDkoyg7-8g_YfRUot-XnaXkNYycsNp7lA5_TW9td0FFpLQ2APzKcZ/s1600/1.jpg)
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYQ0N5W1qAOxLP7t7iOM6O6AzbZnkXUy16s7P_CWfOb5UbTQY_aDsc727chyphenhyphen5W4IppVNernMMQeaUFTB_rFzAd95_CDt-tnwN-nBx6JyUp2duGjPaL5-VgNO41AVsA_vu30EJcipdDG409/s400/Clash+Royale+CLAN+TAG%2523URR8PPP.png)
up vote
2
down vote
favorite
I am trying to find a way to query the state of my laptop from the terminal. I would like to know if it is asleep or awake.
Is there a dbus query suitable for this?
dbus detect
 |Â
show 2 more comments
up vote
2
down vote
favorite
I am trying to find a way to query the state of my laptop from the terminal. I would like to know if it is asleep or awake.
Is there a dbus query suitable for this?
dbus detect
What do you mean by asleep? well when you start typing it's active...
â Ravexina
Mar 28 at 20:40
4
Still I can't get what do you mean by asleep, you can get the IDLE time usingxprintidle
, when your PC is sleep, well it's off, it can't do anything.
â Ravexina
Mar 28 at 20:43
2
Sleep mode suspends the system to RAM so nothing is running. You would not be able to connect to your system in sleep mode, unless you had WOL (Wake On LAN) configured to wake the system back up so you could use it. It sounds to me that you would not be able to see if your system is asleep as it would wake up once you connected to it. See: en.wikipedia.org/wiki/Sleep_mode
â Terrance
Mar 28 at 21:14
1
This is like asking your roommate whether he's asleep. Assuming he doesn't lie, there's no way he'd ever answer yes.
â Byte Commander
Mar 28 at 23:06
2
Reviewers: Although this question does appear to hinge on a misunderstanding of what sleep mode entails, this can be addressed in an an answer, which would answer the question. @Terrance Can you post something like that comment as an answer?
â Eliah Kagan
Mar 29 at 20:36
 |Â
show 2 more comments
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I am trying to find a way to query the state of my laptop from the terminal. I would like to know if it is asleep or awake.
Is there a dbus query suitable for this?
dbus detect
I am trying to find a way to query the state of my laptop from the terminal. I would like to know if it is asleep or awake.
Is there a dbus query suitable for this?
dbus detect
dbus detect
asked Mar 28 at 20:31
Senior-Jesticle
142
142
What do you mean by asleep? well when you start typing it's active...
â Ravexina
Mar 28 at 20:40
4
Still I can't get what do you mean by asleep, you can get the IDLE time usingxprintidle
, when your PC is sleep, well it's off, it can't do anything.
â Ravexina
Mar 28 at 20:43
2
Sleep mode suspends the system to RAM so nothing is running. You would not be able to connect to your system in sleep mode, unless you had WOL (Wake On LAN) configured to wake the system back up so you could use it. It sounds to me that you would not be able to see if your system is asleep as it would wake up once you connected to it. See: en.wikipedia.org/wiki/Sleep_mode
â Terrance
Mar 28 at 21:14
1
This is like asking your roommate whether he's asleep. Assuming he doesn't lie, there's no way he'd ever answer yes.
â Byte Commander
Mar 28 at 23:06
2
Reviewers: Although this question does appear to hinge on a misunderstanding of what sleep mode entails, this can be addressed in an an answer, which would answer the question. @Terrance Can you post something like that comment as an answer?
â Eliah Kagan
Mar 29 at 20:36
 |Â
show 2 more comments
What do you mean by asleep? well when you start typing it's active...
â Ravexina
Mar 28 at 20:40
4
Still I can't get what do you mean by asleep, you can get the IDLE time usingxprintidle
, when your PC is sleep, well it's off, it can't do anything.
â Ravexina
Mar 28 at 20:43
2
Sleep mode suspends the system to RAM so nothing is running. You would not be able to connect to your system in sleep mode, unless you had WOL (Wake On LAN) configured to wake the system back up so you could use it. It sounds to me that you would not be able to see if your system is asleep as it would wake up once you connected to it. See: en.wikipedia.org/wiki/Sleep_mode
â Terrance
Mar 28 at 21:14
1
This is like asking your roommate whether he's asleep. Assuming he doesn't lie, there's no way he'd ever answer yes.
â Byte Commander
Mar 28 at 23:06
2
Reviewers: Although this question does appear to hinge on a misunderstanding of what sleep mode entails, this can be addressed in an an answer, which would answer the question. @Terrance Can you post something like that comment as an answer?
â Eliah Kagan
Mar 29 at 20:36
What do you mean by asleep? well when you start typing it's active...
â Ravexina
Mar 28 at 20:40
What do you mean by asleep? well when you start typing it's active...
â Ravexina
Mar 28 at 20:40
4
4
Still I can't get what do you mean by asleep, you can get the IDLE time using
xprintidle
, when your PC is sleep, well it's off, it can't do anything.â Ravexina
Mar 28 at 20:43
Still I can't get what do you mean by asleep, you can get the IDLE time using
xprintidle
, when your PC is sleep, well it's off, it can't do anything.â Ravexina
Mar 28 at 20:43
2
2
Sleep mode suspends the system to RAM so nothing is running. You would not be able to connect to your system in sleep mode, unless you had WOL (Wake On LAN) configured to wake the system back up so you could use it. It sounds to me that you would not be able to see if your system is asleep as it would wake up once you connected to it. See: en.wikipedia.org/wiki/Sleep_mode
â Terrance
Mar 28 at 21:14
Sleep mode suspends the system to RAM so nothing is running. You would not be able to connect to your system in sleep mode, unless you had WOL (Wake On LAN) configured to wake the system back up so you could use it. It sounds to me that you would not be able to see if your system is asleep as it would wake up once you connected to it. See: en.wikipedia.org/wiki/Sleep_mode
â Terrance
Mar 28 at 21:14
1
1
This is like asking your roommate whether he's asleep. Assuming he doesn't lie, there's no way he'd ever answer yes.
â Byte Commander
Mar 28 at 23:06
This is like asking your roommate whether he's asleep. Assuming he doesn't lie, there's no way he'd ever answer yes.
â Byte Commander
Mar 28 at 23:06
2
2
Reviewers: Although this question does appear to hinge on a misunderstanding of what sleep mode entails, this can be addressed in an an answer, which would answer the question. @Terrance Can you post something like that comment as an answer?
â Eliah Kagan
Mar 29 at 20:36
Reviewers: Although this question does appear to hinge on a misunderstanding of what sleep mode entails, this can be addressed in an an answer, which would answer the question. @Terrance Can you post something like that comment as an answer?
â Eliah Kagan
Mar 29 at 20:36
 |Â
show 2 more comments
1 Answer
1
active
oldest
votes
up vote
5
down vote
Sleep mode on a computer suspends its current state to the RAM. The computer will then go into a low power mode keeping enough power going to the RAM to keep the suspended state. No applications are running at this time.
To wake the computer back up from a remote session would have to be done by a WOL (Wake On LAN) which is controlled by the motherboard. This would then wake the system back up. ssh daemons would not be running at the time the system is asleep so you would not be able to connect to the host that way. Once the magic packet is sent to WOL, the system would no longer be in the sleep state so the answer would be false every time for sleep.
See https://en.wikipedia.org/wiki/Sleep_mode for more information.
There would be one other way to find out if a system is powered on or not from a remote console but that requires special hardware that supports Out-of-band Management that is normally built into server hardware. There are some remote power management items that can be purchased for systems without the management, but they can be pricey and only control the power itself. Here are some that I did a quick search for.
Hope this helps!
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
5
down vote
Sleep mode on a computer suspends its current state to the RAM. The computer will then go into a low power mode keeping enough power going to the RAM to keep the suspended state. No applications are running at this time.
To wake the computer back up from a remote session would have to be done by a WOL (Wake On LAN) which is controlled by the motherboard. This would then wake the system back up. ssh daemons would not be running at the time the system is asleep so you would not be able to connect to the host that way. Once the magic packet is sent to WOL, the system would no longer be in the sleep state so the answer would be false every time for sleep.
See https://en.wikipedia.org/wiki/Sleep_mode for more information.
There would be one other way to find out if a system is powered on or not from a remote console but that requires special hardware that supports Out-of-band Management that is normally built into server hardware. There are some remote power management items that can be purchased for systems without the management, but they can be pricey and only control the power itself. Here are some that I did a quick search for.
Hope this helps!
add a comment |Â
up vote
5
down vote
Sleep mode on a computer suspends its current state to the RAM. The computer will then go into a low power mode keeping enough power going to the RAM to keep the suspended state. No applications are running at this time.
To wake the computer back up from a remote session would have to be done by a WOL (Wake On LAN) which is controlled by the motherboard. This would then wake the system back up. ssh daemons would not be running at the time the system is asleep so you would not be able to connect to the host that way. Once the magic packet is sent to WOL, the system would no longer be in the sleep state so the answer would be false every time for sleep.
See https://en.wikipedia.org/wiki/Sleep_mode for more information.
There would be one other way to find out if a system is powered on or not from a remote console but that requires special hardware that supports Out-of-band Management that is normally built into server hardware. There are some remote power management items that can be purchased for systems without the management, but they can be pricey and only control the power itself. Here are some that I did a quick search for.
Hope this helps!
add a comment |Â
up vote
5
down vote
up vote
5
down vote
Sleep mode on a computer suspends its current state to the RAM. The computer will then go into a low power mode keeping enough power going to the RAM to keep the suspended state. No applications are running at this time.
To wake the computer back up from a remote session would have to be done by a WOL (Wake On LAN) which is controlled by the motherboard. This would then wake the system back up. ssh daemons would not be running at the time the system is asleep so you would not be able to connect to the host that way. Once the magic packet is sent to WOL, the system would no longer be in the sleep state so the answer would be false every time for sleep.
See https://en.wikipedia.org/wiki/Sleep_mode for more information.
There would be one other way to find out if a system is powered on or not from a remote console but that requires special hardware that supports Out-of-band Management that is normally built into server hardware. There are some remote power management items that can be purchased for systems without the management, but they can be pricey and only control the power itself. Here are some that I did a quick search for.
Hope this helps!
Sleep mode on a computer suspends its current state to the RAM. The computer will then go into a low power mode keeping enough power going to the RAM to keep the suspended state. No applications are running at this time.
To wake the computer back up from a remote session would have to be done by a WOL (Wake On LAN) which is controlled by the motherboard. This would then wake the system back up. ssh daemons would not be running at the time the system is asleep so you would not be able to connect to the host that way. Once the magic packet is sent to WOL, the system would no longer be in the sleep state so the answer would be false every time for sleep.
See https://en.wikipedia.org/wiki/Sleep_mode for more information.
There would be one other way to find out if a system is powered on or not from a remote console but that requires special hardware that supports Out-of-band Management that is normally built into server hardware. There are some remote power management items that can be purchased for systems without the management, but they can be pricey and only control the power itself. Here are some that I did a quick search for.
Hope this helps!
edited Mar 29 at 21:42
answered Mar 29 at 21:26
![](https://i.stack.imgur.com/1hPwN.jpg?s=32&g=1)
![](https://i.stack.imgur.com/1hPwN.jpg?s=32&g=1)
Terrance
17.3k23784
17.3k23784
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1020088%2fhow-to-detect-if-computer-is-asleep%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
What do you mean by asleep? well when you start typing it's active...
â Ravexina
Mar 28 at 20:40
4
Still I can't get what do you mean by asleep, you can get the IDLE time using
xprintidle
, when your PC is sleep, well it's off, it can't do anything.â Ravexina
Mar 28 at 20:43
2
Sleep mode suspends the system to RAM so nothing is running. You would not be able to connect to your system in sleep mode, unless you had WOL (Wake On LAN) configured to wake the system back up so you could use it. It sounds to me that you would not be able to see if your system is asleep as it would wake up once you connected to it. See: en.wikipedia.org/wiki/Sleep_mode
â Terrance
Mar 28 at 21:14
1
This is like asking your roommate whether he's asleep. Assuming he doesn't lie, there's no way he'd ever answer yes.
â Byte Commander
Mar 28 at 23:06
2
Reviewers: Although this question does appear to hinge on a misunderstanding of what sleep mode entails, this can be addressed in an an answer, which would answer the question. @Terrance Can you post something like that comment as an answer?
â Eliah Kagan
Mar 29 at 20:36