Tip #452 Command line stop watch
I wanted a simple (accurate to the second) stop watch when I was at the command line. So I did a quick one-liner.
START=$( date +%s ); while true; do CURRENT=$( date +%s ) ; echo $(( CURRENT-START )) ; sleep 1 ; echo -n ^[[A ; done
Note that the strange symbol after the 'echo -n' is the result of pressing 'CTRL-v' then the up arrow. If you want it to give you a 'split' just hit enter and it'll move onto the next line. Remember it's only second accurate so only one split per second will work. Hit 'CTRL-c' to stop it.
- TAGS:
alias aptitude at awk bash bc cal cat cd colrm comm cp csh curl cut date dd df dialog diff dirname dpkg du fc find fuser grep gs gzip history iconv kill ksh last less ln ls lsof lynx m4 md5sum mkdir mkfifo mkisofs mv mysql nc netstat openssl OSX perl ping popd ps pushd python read redirection rm scp screen sed sort ssh stat sudo svn tail tar tee test top tr uniq vim wc wget xargs