How do I set the pullup using /sys/class/gpio/gpio$PIN/
echo 1 > /sys/class/gpio/gpio$PIN/value
does not seem to work.
I'm not sure that you can set the internal pull-up/pull-downs via the sysfs interface. I have never done so, but I don't often use sysfs.
From the command line there are many methods. The following examples assume Broadcom gpio 4.
pigs pud 4 u # up pigs pud 4 d # down pigs pud 4 o # off
raspi-gpio set 4 pu # up raspi-gpio set 4 pd # down raspi-gpio set 4 pn # off
gpio -g mode 4 up # up gpio -g mode 4 down # down gpio -g mode 4 tri # off