Repeat URL request in Linux command line

Sending N times URL request in Linux command line is quite easy. There are various tools available for doing that. Here I will introduce just two of them I have ever used.

First one is CURL which is very popular and useful tool and it can be used for various purposes and one is for URL request or simply sending HTTP request and getting data from server. With applying some Bash script, it is very easy to repeat the process of HTTP request N times. Following command sending HTTP request to Google 100 times.

for((i=0;i<100;i++)) do curl --connect-timeout 3 ''; done;

If you do not understand the above command do not worry, it is one simple for loop which repeats 100 times and inside of the loop curl command sends HTTP request with 0 times out. The reason for putting 3 time out is for speeding the process of sending request since the intention is not to see the content of the page. Even with decreasing time out value still the speed is slow that is why I found the second way which is using ab command.

With ab command you can sending HTTP request N times and also M number of request in each HTTP request. Check below command for better understanding,

ab -n 100 -c 1000 ''

In above command, ab sends HTTP request 100 times and in each request sends 1000 requests. Means at the end of running ab command with the above parameters we already sent 100*1000 = 100000 HTTP request to Google.

Send your idea and information to

Leave a Reply