Restarting Unity desktop in Ubuntu

If your desktop seems to freeze for more than a few seconds, trying pressing together the keys
Ctrl Alt F1
and then login with your username and password, and type
unity & disown
This will leave your desktop/apps all as they were while fixing the broken state.

To just restart the whole Unity desktop (which is like unto logging out and logging in, discarding your current desktop), instead type
sudo service lightdm restart

using wakeonlan with Linux–from outside LAN (worldwide)

On target (PC to be remotely controlled) do:

  1. sudo apt-get ethtool
  2. backup your /etc/network/interfaces file:
    sudo cp /etc/network/interfaces /etc/network/interfaces.backup

  3. sudo nano /etc/network/interfaces
    You should see a segment that looks like the following. If not, try adding it. Note, if this goofs up, you may not have network access for your machine until you copy the .backup file you made in the previous step!

    auto eth0
    iface eth0 inet dhcp
    up ethtool -s eth0 wol g

  4. sudo nano /etc/init.d/halt
    change the text near the top of the file to say
    NETDOWN=no
    instead of yes.
  5. type ifconfig and note HWaddr for eth0–this is MAC address
  6. Reboot remote PC, then shutdown remote PC

—————————
On controlling PC, do:
sudo apt-get install wakeonlan

To wakeup remote PC, on your control PC (while on the same LAN), type
wakeonlan HWaddr
WHERE HWaddr is the MAC address of the remote PC

E.g. if HWaddr of remote PC is 00:11:22:33:44:55
then type on the control PC (on the same LAN):
wakeonlan 00:11:22:33:44:55

———–
Now, that you have that working, let’s do the worldwide version.
You will need to have Port Forwarding capability to your PC from your router
Otherwise, you would have to be on the same subnet–perhaps via VPN.

Let’s assume your remote PC is assigned the DHCP reserved address 192.168.1.100 by your router. Let’s also assume you forwarded say port 1234 to port 22 for SSH/RDP control.

Now, setup your router to forward a second port, say 4321 for UDP packets to port 9 (port 9 is Wake on Lan magic packet port), to 129.168.1.100.

Finally, you need to know the WAN (world-facing) address of your router–this needs to be relatively fixed, or use one of the “DynDNS” type services. These days it seems a lot of internet providers keep the same IP addresses for their customers for long periods of time (years). Let’s say you used whatismyip.com to find that your WAN address is 10.90.80.1 (yes, this example IP is for private networks–I deliberately chose an invalid WAN address for this example)

From your control PC (which will now need to be on a different network to really test–use your 3G modem or VPN to another network, or just go to the local coffeeshop WLAN) and type in Terminal:

wakeonlan -i 10.90.80.1 -p 4321 00:11:22:33:44:55

and your PC should have powered itself on.

If it didn’t, try it first using just the LAN with the earlier example–you need to check your BIOS/UEFI settings so that Wake On Lan is enabled. Worst case, you may need to try a discrete Intel Ethernet NIC, available cheaply these days (~$30 at Newegg et al).

Reference:

https://help.ubuntu.com/community/WakeOnLan