how to rename a linux network interface without a reboot

linux can be so dumb. it’s bad enough that some distro’s give the network interface names like enp2s0, but until recently, it was nigh on impossible to change that name without hacking udev files and a reboot.

well, the linux-centric ip tool allows the rename without requiring a reboot. these lines are in my void linux /etc/rc.local file:

/usr/bin/ifconfig enp2s0 down || /bin/true  # ignore errors
/usr/bin/ip link set enp2s0 name eth0
/usr/bin/ifconfig eth0 up

yes, i did xbps-install inetutils to get ifconfig. (sigh) installed to /usr/bin… and yes, i could edit some darned udevd file, but…