Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

176
Vistas
/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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda