First off you need to connect the camera and enable using the raspi-configraspistill -o image.jpg
This saves a photo as "image.jpg" in the current directory.
If you get an error like
mmal: mmal_vc_component_enable: failed to enable component: ENOSPC mmal: camera component couldn't be enabled mmal: main: Failed to create camera component mmal: Failed to run camera app. Please check for firmware updates
Change the quality:
raspistill -q 50 -o image.jpg
This saves a photo as "image.jpg" with 50% quality therefore saving size.
Taking a video for 5 seconds:
raspivid -o video.h264
This takes a video for the default time of 5 seconds and saves it as "video.h264".
Taking a video for a different time:
raspivid -t 120 -o video.h264
This takes a video for 120 seconds or 2 mins. Make sure you have enough space on your sd card as these videos can get large very quickly.