Home

Awesome

fish-command-timer

FishShell extension for printing timing information for each command executed.

Usage

After the execution of each command, the script prints out the total execution time (up to millisecond precision), followed by the current time. The execution time is formatted to be human-readable; e.g., 2h 7m 42s301.

Demo:

Demo Screen-cap

Additionally, the script will export the total execution time (as a human-readable string, e.g., 42s027) as $CMD_DURATION_STR. You can use this variable in your subsequent prompt.

Requirements

This script requires fish shell 2.2 or above. It should run pretty much out of the box on modern Linux and Mac OS X systems. Please report any incompatibilities on GitHub.

Installation

  1. Download conf.d/fish_command_timer.fish and put it in ~/.config/fish/conf.d/ as per Fish shell convention.
  2. If the above doesn't work for you (perhaps because your custom settings overrides the extension), you could try sourcing it directly. Download conf.d/fish_command_timer.fish and put it in ~/.config/fish/, then add the following in your ~/.config/fish/config.fish at the end:
    source ~/.config/fish/fish_command_timer.fish
    

That's it :)

Settings

You can use the following options to tweak the behavior of the script. Put them in your config.fish. You can also modify them on-the-fly if you want the changes to only affect your current shell session.