Debian
echo "US/Pacific" > /etc/timezone
dpkg-reconfigure --frontend noninteractive tzdata
Ubuntu (assuming you are not root)
echo "US/Pacific" | sudo tee /etc/timezone
sudo dpkg-reconfigure --frontend noninteractive tzdata
NOTE: there is no need to reboot the system for the new settings to apply