View time taken of last command in Fish shell

· · 70 words · 1 minute read

Just use $CMD_DURATION to get the time taken running the last command.

To make your prompt give you the elapsed time for every command you run in Terminal, add this function in your Fish config file ~/.config/fish/

function fish_prompt; echo "$CMD_DURATION  "; end

The prompt will be like that.

Terminal prompt with elapsed time in Fish script

I hope this helps you. You know someone will benefit from this, share it with him/her, a friend or colleage.