I have a shell script named 'lookup' that lets me know (through twilio) the location, mobile carrier, and registered name of a phone number.
I wrote it to quickly identify mobile vs. non-mobile numbers that I might text - also from the command line.
I won't paste the entire script here (mostly authentication and argument parsing) but the meat of it is:
/usr/local/bin/curl -X GET "https://lookups.twilio.com/v1/PhoneNumbers/$number?Type=carrier&Type=caller-name" -u $accountsid:$authtoken
I use this several times weekly.EDIT: by "location" I mean their mobile country code - not their actual location which, of course, you cannot get without (ab)using SS7 which is beyond the scope of twilio ...