Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to reduce the keystrokes when I use curl to test web services on my workstation.

Is there a way to set a default hostname of 'localhost:3000' into ~/.curlrc so the following will work?

curl /foo.json
share|improve this question

On Unix – shell functions:

cu() { curl "http://localhost:3000/$1"; }

cu foo.json would be translated to curl http://localhost:3000/foo.json.

Downside: needs far more code to support options (curl -I and stuff), but that can be achieved too.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .