Tip #573 When did I start work today
I noticed a one liner here for working out when you started work that day. The code given was:date "+%b %d" | xargs -i grep -m1 -i {} /var/log/syslog.0 |awk '{ print "Today I got to work at " $3 }'
This basically just gets the time the machine was started that day.
There are a few problems here, firstly this can be done a lot easier with the 'uptime' command. More importantly though the machine I work on doesn't get rebooted each day so instead of the startup time I'd need the time I first logged in that day. This can be achieved with the following:
last $USER | sed -n '/'"$(date +"%b %d")"'/!q; p' | tail -1 | awk '{ print "Today I got to work at " $7 }'
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