To begin with I am a novice, both with `REST` and `cURL`. This is what I want to do:

I want to query the Twitter Rest API using commandline (some bash script) and hence, I want to use `cURL` to do that. 

I have been trying to search for some tutorial (with no luck) that explains how to use `REST` with `cURL` and how to form the headers, get/post and then how to receive the `REST` response and the response status, so that I can write my logic based on the response status. 

I would greatly appreciate if you can give me a few examples on how to call the twitter REST API using curl and also how to access the `REST` response status. 

I tried calling twitter using this:

```
curl "http://api.twitter.com/1/statuses/user_timeline.json?include_entities=true&screen_name=$user_name&count=150"

```

And got a json which I was able to use in my program. But I am not sure how to access the rest response status codes (in order to make my implementation more reliable). Also, I am not sure about what other flags should I provide to the cURL while calling it. 

PS: Just to add, if you think there is some other MUCH better alternative to retrieving data from REST API other that using cURL, then also please let me know. Though my application is not web based and is more data crunching oriented and that's why I chose commandline and bash.