4

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 but it does not work and still display data in my ssh window.

4

3 回答 3

4

您可以按照以下代码进行操作。

ab -k -n 2000 -c 10 -g Example.txt http://www.example.com/ >ExampleResult.txt 2>&1 
于 2017-08-12T17:27:45.170 回答
2

尝试将“2>&1”放在“>file.txt”之后。

于 2010-02-12T22:20:52.410 回答
0

如果在 MacOS 上,您也可以直接将输出复制到剪贴板。

# MacOS copies result to clipboard
ab -k -n 2000 -c 10 http://www.example.com/ 2>&1 | pbcopy
于 2021-03-12T14:41:32.487 回答