![]() The date command isn’t used as much to set time any more, since most systems rely on a Network Time Protocol (NTP) server to supply date and time information. To grab the date formatted as such, the following command can be used:ĭate -j -f “%a %b %d %T %Z %Y” “`date`” “+%s” Some of you will be using log analyzers that depend, for example, on unix epoch time. Now, in our shell script we can create files, add lines to files, etc, with the shortened date stamp. Here we’re going to grab the current system date from ESX, OS X or Linux (or whatever OSen really) and then use a variable, currentdate, to put that date, formatted into a pretty standard format, YYYYMMDD:Ĭurrentdate=`date ”+%c%m%d” | awk ‘’` In a script this can choose fairly challenging, especially in cases where you just need the date stamp without the time and time zone, etc. ![]() At a terminal prompt, it is really straight forward to grab the date, simply use the date command, with no arguments and you will get something similar to the following, including the day, date, time (with seconds), time zone and year: ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |