Server Fault is a question and answer site for system and network administrators. 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 save ApacheBench (ab) tool on linux to a file. When I run it with -v 2 it displays some results in my ssh window. How to move these data into a file and make sure that it will not display on ssh no more? I've tried > file.txt 2>&1 but it does not work and still display data in my ssh window.

I use:

ab -n 10000 -c 200 > file.txt 2>&1
share|improve this question
I have tried and ab .... > file.txt does not output anything to the terminal, are you certain you did not make a typo ? – mat Feb 13 '10 at 8:59
@mat I 've added my command to question, hope to have your help – tomaszs Feb 13 '10 at 9:24
That particular command don't output anything for me, it just spits everything into the file. If you don't need the Completed ... requests, you should add -q to the command line, and you could get rid of 2>&1. – mat Feb 13 '10 at 10:03
Crossposted here:… – Dennis Williamson Feb 13 '10 at 10:14
I tried it with bash and with dash and do not see your symptoms. Details posted as my answer. Are you cetain you are using bash? echo $SHELL will say bash if it is bash. – Paul Feb 13 '10 at 13:27
up vote 2 down vote accepted

Sorry nothing here but cat poo.

I do note that ab doesn't work for me unless the url has a filename or a / at the end.

Errors still go into the file, though.

Is this what you are doing? (on something other than localhost, of course)

pjb@pjb-desktop:~$ ssh localhost -l pjb
pjb@localhost's password: 
Linux pjb-desktop 2.6.31-19-server #56-Ubuntu SMP Thu Jan 28 03:40:48 UTC 2010 x86_64

To access official Ubuntu documentation, please visit:

Last login: Sat Feb 13 04:37:53 2010 from localhost
pjb@pjb-desktop:~$ ab -v 2 -n 10000 -c 200 http://localhost/ > poo 2>&1

See, nothing.

It's all in the cat poo.

With -v2 you get lots of these in cat poo

This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd,
Licensed to The Apache Software Foundation,

Benchmarking localhost (be patient)
INFO: POST header == 
GET / HTTP/1.0
Host: localhost
User-Agent: ApacheBench/2.3
Accept: */*

LOG: header received:
HTTP/1.1 200 OK
Date: Sat, 13 Feb 2010 12:56:45 GMT
Server: Apache/2.2.12 (Ubuntu)
Last-Modified: Tue, 17 Feb 2009 09:18:13 GMT
ETag: "120175-2d-46319c8521f40"
Accept-Ranges: bytes
Content-Length: 45
Connection: close

Otherwise without -v2 it looks like this

pjb@pjb-desktop:~$ cat poo
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd,
Licensed to The Apache Software Foundation,

Benchmarking localhost (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Completed 10000 requests
Finished 10000 requests

Server Software:        Apache/2.2.12
Server Hostname:        localhost
Server Port:            80

Document Path:          /
Document Length:        45 bytes

Concurrency Level:      200
Time taken for tests:   1.477 seconds
Complete requests:      10000
Failed requests:        0
Write errors:           0
Total transferred:      2980894 bytes
HTML transferred:       450135 bytes
Requests per second:    6772.68 [#/sec] (mean)
Time per request:       29.530 [ms] (mean)
Time per request:       0.148 [ms] (mean, across all concurrent requests)
Transfer rate:          1971.55 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.6      0       6
Processing:     4   17 107.8      9    1467
Waiting:        4   17 107.9      9    1467
Total:          6   18 108.1      9    1471

Percentage of the requests served within a certain time (ms)
  50%      9
  66%      9
  75%      9
  80%      9
  90%     10
  95%     11
  98%     13
  99%     15
 100%   1471 (longest request)
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.