7

Is there a way to run all commands in bash as if they were invoked with time in front? I want that I could type $ some_command and this will actually invoke $ time some_command.

Dror
  • 171
  • 3
  • Not very well http://superuser.com/questions/175799/does-bash-have-a-hook-that-is-run-before-executing-a-command. Perhaps zsh… – msw Sep 23 '13 at 12:04
  • zsh with the [grml zsh config](http://grml.org/zsh/) does this by default. It shows the time only if it exceeds a certain value. – jofel Sep 23 '13 at 12:13
  • 1
    @jofel. Actually, with `zsh`, it's just a matter of `REPORTTIME=0` (report time of those processes that take more than 0 seconds). – Stéphane Chazelas Sep 23 '13 at 12:32
  • I am looking for an answer using `bash`. I don't think I'll change my shell just because of this feature. – Dror Sep 23 '13 at 19:15
  • There are [other reasons](http://unix.stackexchange.com/questions/983/what-features-are-in-zsh-and-missing-from-bash-or-vice-versa) to change your shell. – Gilles 'SO- stop being evil' Sep 23 '13 at 20:50

1 Answers1

0

Itself time command do it :

time ls
time gimp

But if you want to invoke time for each command, you can customize a script for yourself, you should run everything with it but it's not good way.

PersianGulf
  • 10,728
  • 8
  • 51
  • 78