GNU date tutorial (Linux command line series)
date is part of the GNU Coreutils or core system utilities on a GNU/Linux system. It is a command line program that tells you the current date.
Basic usage
Just type the command date on the terminal:
[agronesia]$ date Sun Jun 8 02:11:51 PDT 2008
It will display the date according to the system’s time zone, in that case PDT.
To display the time in UTC, use the -u switch:
[agronesia]$ date -u Sun Jun 8 09:11:56 UTC 2008
Formatting the date and time
To begin a format string, you must type +. After that, use the available formatters such as %Y (year), %m (month), and %d (date). Here’s an example:
[agronesia]$ date +%Y-%m-%d 2008-06-08
To see other format specifiers, see the help by typing date -h.
Closing remarks
You can use the output for the input of other programs, for example for a shell script that backups an SQL database (to name the backup folder/file).
Tags: administration, command, command line, date, gnu, Linux, unix










