Команда date

Tells you the date and time in Unix.

Синтаксис

date [-a] [-u] [-s datestr]

-aSlowly adjust the time by sss.fff seconds (fff represents fractions of a second). This adjustment can be positive or negative. The system's clock will be sped up or slowed down until it has drifted by the number of seconds specified. Only the super-user may adjust the time.
-uDisplay (or set) the date in Greenwich Mean Time (GMT-universal time), bypassing the normal conversion to (or from) local time.
-s datestrSets the time and date to the value specfied in the datestr. The datestr may contain the month names, timezones, 'am', 'pm', etc. See examples for an example of how the date and time can be set.

Примеры

date - Would list the date and time of the server. Below is an example of the output.

Thu Feb 8 16:47:32 MST 2001

date -s "11/20/2003 12:48:00" - Set the date to the date and time shown.

date '+DATE: %m/%d/%y%nTIME:%H:%M:%S' - Would list the time and date in the below format:

DATE: 02/08/01
TIME:16:44:55

Обратно к списку команд