Live timer and logger of command execution times.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Live timer and logger of command execution times.

Quick Start

Download and install the script:

curl -o ~/.cmd-timer
source ~/.cmd-timer install

File will be downloaded and appropriate entries will be added to your .bashrc or .profile file. Alias cmdt will be created for your convenience.



  • No effort required - install and it just works
  • Highly configurable
  • Live timer during command execution
  • Summary after execution
  • Logging of execution times
  • Exclude certain commands, including parameter checking
  • Callback after a command finishes
  • Compatible with Linux and OS X


Configuration can be done by editing variables at the beginning of the script or by overwriting them through user config. The script will look for user config in:


Possible options and their defaults:

# Where to install the script.

# Minimum time before starting the timer, in seconds.

# Display live timer in the corner of your terminal.

# Display the timer in the terminal title.

# Print the summary after the command finishes.

# Enable logging of execution time to file.

# Log file.

# Do not time these commands. Arguments are matched if present, from the left.
_CMDT_EXCLUDE=( vi vim less emacs pv "tail -f" ssh telnet scp ftp man htop top 
    su screen irrsi irc "sudo -s" )

# Callback to execute after the timer finishes. It will be passed to eval.
_CMDT_CALLBACK='echo -ne \\007'


Script can automatically update itself from latest repository version.

cmdt update


cmdt uninstall

Log format

Data is logged as a semicolon separated list, each entry in a new line.

timestamp ; timer ; command ; parameters

How does it work?

The timer is started by the DEBUG trap and stopped throught PROMPT_COMMAND.

Known issues

  • Trap is not removed when uninstalling. It will disappear in your new session or you can remove it manually by running:
trap - DEBUG
  • Problems with pipes!


  • Better list of commands to exclude from timing