Skip to content

Instantly share code, notes, and snippets.

@vagelim
Created January 10, 2023 17:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vagelim/d80ae2b4d0a0a5a9d77b52b32fee5c40 to your computer and use it in GitHub Desktop.
Save vagelim/d80ae2b4d0a0a5a9d77b52b32fee5c40 to your computer and use it in GitHub Desktop.
nc for wol
#!/bin/bash
#replace MAC value with NIC MAC
MAC=11:22:33:44:55:66
echo -e $(echo $(printf 'f%.0s' {1..12}; printf "$(echo $MAC | sed 's/://g')%.0s" {1..16}) | sed -e 's/../\\x&/g') | nc -w1 -u -b 255.255.255.255 4000
# from https://stackoverflow.com/questions/31588035/bash-one-line-command-to-send-wake-on-lan-magic-packet-without-specific-tool
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment