Archive

Monthly Archives: March 2020

wereback

That’s right, after 3053 days No_gui is back! but how did I work that out? With the ‘date’ command of course!

At its simplest, for example if you run ‘date’ with no arguments it will return the current date and time in a human readable format.

date1

We can use the +%s format control option to have date display the number of seconds since the epoch (1st Jan 1970), along with the -d flag and a date in the yyyymmdd format to get the seconds value for the specified date

date2

Returns the number of seconds elapsed since the epoch until 19/11/2011

If we do the same thing with today’s date, and subtract one from the other, we end up with the the number of seconds between the two dates. Divide by the number of seconds in a day (done by piping to ‘bc’), and we have the number of days difference between the two dates, in this case, this blog post and my last.

datescript

And here it is put together, the script that produced the first image in this post! and yes, its true the blog has been inactive for 3053 days! But all that is set to change. Watch out for new posts in the coming days.