To get a list of available software updates, type the following command:
softwareupdate -l
You will see a list of available updates. You can then install all available software updates with the following command:
sudo softwareupdate -iva
The use of sudo is required to get superuser privileges to actually install the updates. You can also install only the recommended updates with:
sudo softwareupdate -irv