Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

170
Visualizações
/usr/bin/time only timing first component of pipeline

I am trying to time the following command and eventually want to output the result to a file (hence the use of /usr/bin/time. However, the command being timed is always seq 1 2 rather than the entirety of the command:

/usr/bin/time -v seq 1 2 | parallel ssh-keygen -G /folder/{}.candidate -b 768

Is there a way to make sure the whole command is timed and not just the first little part?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

If you are using bash it is easier to use the bash built-in:

$ time cmd1 | cmd2 | cmd3

will time the entire pipe.

If you really want to use the external time command, you have to run the pipe in a sub-shell:

$ /usr/bin/time sh -c 'cmd1 | cmd2 | cmd3'

or else you'd be piping the time instead of timing the pipe.

This syntax also has the nice side effect that it is easy to separate the output of the command and that of time:

$ /usr/bin/time sh -c 'cmd1 | cmd2 > cmdout.txt 2> cmderr.txt' 2>> time.txt

However, it has an extra difficulty in the quotes. If your command itself contains quotes, you may need to escape them in hard to read ways.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda