Mac OS X provides a command "softwareupdate" to update your mac from terminal. The command is very easy to use and can be used as below.
To install all the mac os x updates:
sudo softwareupdate -i -a
To install only recommended os updates:
sudo softwareupdate -i -r
To install all the mac os x updates:
sudo softwareupdate -i -a
To install only recommended os updates:
sudo softwareupdate -i -r