Suppose you only want to keep files in a particular bucket around for just one day, then you can set up the lifecycle rule for the bucket with:
echo '{ "rule": [{ "action": {"type": "Delete"}, "condition": {"age": 1}}]}' > lifecycle_config.json
gsutil lifecycle set lifecycle_config.json gs://example-bucket
Now, any objects in your bucket older than a day will automatically get deleted from this bucket.
You can verify the configuration you just set with the gsutil lifecycle command (other configuration commands work in a similar fashion):
gsutil lifecycle get gs://example-bucket