HowTo: Wake Up Computers Using Linux Command [ Wake-on-LAN ( WOL ) ]

Wake-on-LAN (WOL) is an Ethernet networking standard that allows a server to be turned on by a network message. You need to send ‘magic packets’ to wake-on-lan enabled ethernet adapters and motherboards, in order to switch on the called systems. Make sure you connect the NIC (eth0 or eth1) with the motherboard, and enable the WOL function in the BIOS. This is a quick guide to enable WOL under RHEL / Fedora / CentOS / Debian / Ubuntu Linux.

Client Software

You need to use software to send WoL magic packets. You will find various tools for all modern oses, including MS-Windows, Apple OS X, Linux, and many smart phones.

Linux Install etherwake Under Debian / Ubuntu Linux

etherwake command can be used to send a Wake-On-LAN “Magic Packet” under Linux operating systems. Type the following command to install the same under Debian / Ubuntu Linux desktop:
$ sudo aptitude install etherwake
Sample outputs:

[sudo] password for vivek:
The following NEW packages will be installed:
  etherwake wakeonlan{a}
0 packages upgraded, 2 newly installed, 0 to remove and 11 not upgraded.
Need to get 20.9 kB of archives. After unpacking 98.3 kB will be used.
Do you want to continue? [Y/n/?] y
Get:1 squeeze/main etherwake amd64 1.09-3 [9,564 B]
Get:2 squeeze/main wakeonlan all 0.41-10 [11.4 kB]
Fetched 20.9 kB in 2s (10.3 kB/s)
Selecting previously deselected package etherwake.
(Reading database ... 195338 files and directories currently installed.)
Unpacking etherwake (from .../etherwake_1.09-3_amd64.deb) ...
Selecting previously deselected package wakeonlan.
Unpacking wakeonlan (from .../wakeonlan_0.41-10_all.deb) ...
Processing triggers for man-db ...
Setting up etherwake (1.09-3) ...
Setting up wakeonlan (0.41-10) ...

Note: Red Hat Linux and friends user should use net-tools package which is installed by default.

How Do I Send WOL Magic Packets Under Linux?

Type the following command:
# wakeonlan MAC-Address-Here
# etherwake MAC-Address-Here
# etherwake -D MAC-Address-Here

RHEL / Centos / Fedora Linux user, try:
# ether-wake MAC-Address-Here
If your MAC address were xx:yy:zz:11:22:33, you would type:
# wakeonlan xx:yy:zz:11:22:33
# etherwake xx:yy:zz:11:22:33

  • xx:yy:zz:11:22:33 is remote servers mac address. You can obtained mac address using combination of ping and arp command – ‘ping -c 4 server3 && arp -n‘.

How Do I Verify That Remote Linux Server Supports Wake-on-LAN (WOL)?

First, reboot the remote server and go to BIOS > Power Management > “Wake On LAN”. Turn it on. Next, save and close the bios. After activating Wake On LAN in hardware (BIOS) it is also necessary to activate it using ethtool. The ethtool will configure eth0 to respond to the magic packet:
# ethtool -s eth0 wol g

  1. -s eth0 : Your NIC. Feel free to replace eth0 with your actual network interface device name.
  2. wol g : Sets Wake-on-LAN options using MagicPacket.

Type the following command to see current status of wol for eth0:
# ethtool eth0
Sample outputs:

Settings for eth0:
	Supported ports: [ ]
	Supported link modes:
	Supports auto-negotiation: No
	Advertised link modes:  Not reported
	Advertised auto-negotiation: No
	Speed: 100Mb/s
	Duplex: Full
	Port: MII
	Transceiver: internal
	Auto-negotiation: off
        Supports Wake-on: g
       Wake-on: g
	Link detected: yes

If you are using RHEL / SL / Fedora / CentOS Linux, edit /etc/sysconfig/network-scripts/ifcfg-eth0:
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
Add / modify the following line:



ETHTOOL_OPTS="wol g autoneg off speed 100 duplex full "

Save and close the file. If you are using Debian / Ubuntu Linux, edit /etc/network/interfaces:
# vi /etc/network/interfaces
Append the following to eth0:

auto eth0
iface eth0 inet static
        post-up /sbin/ethtool -s eth0 wol g
        post-down /sbin/ethtool -s eth0 wol g

Recommend readings

  • man pages – ethtool, ether-wake / etherwake, arp, wakeonlan
  • Wake-on-LAN

🐧 Please support my work on Patreon or with a donation.
🐧 Get the latest tutorials on Linux, Open Source & DevOps via:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
14 comments… add one
  • Pulipuli Mar 25, 2017 @ 4:15

    Very useful. Thanks.

  • Ahmed Feb 5, 2016 @ 8:03

    One useful bash script if you want to automate WOL wake and inform user depending on the stats of it.
    NOTE: “hppl-1” is the hostname in the script

    VAR=`ping -s 1 -c 2 hppl-1 > /dev/null; echo $?`
    if [ $VAR -eq 0 ];then
    echo -e "hppl-1 is UP as on $(date)"
    elif [ $VAR -eq 1 ];then
    wakeonlan 9c:b6:12:09:8d:22 | echo "hppl-1 not turned on. WOL packet sent at $(date +%H:%M)"
    sleep 3m | echo "Waiting 3 Minutes"
    PING=`ping -s 1 -c 4 hppl-1 > /dev/null; echo $?`
    if [ $PING -eq 0 ];then
    echo "hppl-1 is UP as on $(date +%H:%M)"
    echo "hppl-1 not turned on - Please Check Network Connections"

    Saw this on this website www. howtovmlinux .com


  • Roger Jollie Mar 22, 2013 @ 22:46

    If you want to shut down or reboot a remote computer such as a Windows box you can do the following:

    net rpc shutdown -I ip or name of computer -U username%password

    If you don’t want to have the password in plain text on the screen omit the %password and you will be prompted for it. if you use a -r switch the computer will reboot. If you are on a domain network you can use your domain account by using the following


  • Simon Apr 27, 2012 @ 13:35

    Hey there.
    I am searching for a way to send a magic packet with wakeonlan on startup, after the network is there. I already wrote a script but that doesn´t work on startup. The stop-command works though, so the command I give is right. Don´t know what I am doing wrong.

    • 🐧 nixCraft Apr 29, 2012 @ 8:52

      Can you paste your script using pre tags here?

    • Rich May 18, 2014 @ 15:23

      Did you ever figure this out? I’m trying to do the same thing.

  • Nora Apr 18, 2012 @ 5:55

    Should be possible, yes. But then I’d rehatr do a management interface where you can add all the MACs you possible want to wake and make the other thing a drop down menu. This would separate the admin from the user which may be a good thing.

  • Dan Apr 8, 2012 @ 20:50

    Shutdown a linux machine with : “sudo halt “.
    Of course it can work without sudo if you have enough user rights.. ( see doc/ groups)

    WOL is only for wake.

  • zam Apr 4, 2012 @ 15:44


    can any one please tell me How to shutdown the Computers Using Linux Command [ Wake-on-LAN ( WOL ) ]

    • Alex May 8, 2012 @ 21:32

      ssh into the box and, as root, “shutdown -h now”

      • Ion Jan 27, 2015 @ 19:20

        or poweroff

  • Russell Gadd Apr 4, 2012 @ 8:53

    I’m no expert but looking at Synaptic there is also a wakeonlan command which can be installed.

    In the Synaptic blurb for this package it says:
    You need the MAC addresses of machines to construct the WOL packets, but,
    in contrast to ‘etherwake’, you do not need root privileges to use the
    program itself as UDP packets are used.

    • 🐧 nixCraft Apr 4, 2012 @ 10:53

      Yes, wakeonlan can be run as non-root user, but etherwake must run as root.

  • anand vamsi Apr 4, 2012 @ 3:41

    really a helpful command need to experiment.

Leave a Reply

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

Use HTML <pre>...</pre> for code samples. Problem posting comment? Email me @