Shell UNIX:使用管道重定向某些命令

Shell UNIX:使用管道重定向某些命令,shell,unix,command,Shell,Unix,Command,我是Unix新手。下面是我正在执行的命令 $ time ls | wget exampledomain.com > output.txt 我希望命令将检索信息所需的时间输出到output.txt。我使用的这个命令创建了output.txt,但它只是一个空白文档 谢谢wget输出到stderr。使用: wget exampledomain.com > out 2>&1 # or wget exampledomain.com 2>out # or wget exa

我是Unix新手。下面是我正在执行的命令

$ time ls | wget exampledomain.com > output.txt
我希望命令将检索信息所需的时间输出到output.txt。我使用的这个命令创建了output.txt,但它只是一个空白文档


谢谢

wget
输出到stderr。使用:

wget exampledomain.com > out 2>&1
# or
wget exampledomain.com 2>out
# or 
wget exampledomain.com --output-file=log
# or, to redirect the output both to file and stdout
wget exampledomain.com 2>&1 | tee log

ls
输送到
wget
有什么意义?很好,阿卡迪乌斯。从长远来看,我只想提取检索信息所需的时间,并将其输出到文本文件中。我认为时间ls会使这更容易,因为它有较少的无关信息。