Home » linux » Linux and Unix date command tutorial with examples

Linux and Unix date command tutorial with examples

Command “date” is used to display the date of the system.
To see the current date type the command “ date” on the terminal as shown in below

output

The above command will display current day, date, month, year and time as shown above.

Option:
date command can also be used with format specified .
Each format is preceded by + symbol and followed by % operator and format described as a single character.
We want to see only current month use format +%m. as shown below.

output

output is month 01

We want to see only currant month name use format +%h. as show below.

output

output is month January

We can also combine both command as:

output

output is month 01 is January

Other options of date command

Sr NoOptionDescription
1doption used for display date of the month (1 to 31).
2yoption used for display last two digits of current year.
3Hoption used for display hour
4M option used for display minute
5Soption used for display second
6Doption used for display date in the format mm/dd/yy
7Toption used for display the time in the format hh:mm:ss
Managed by MochaHost - Fast & Easy WordPress Hosting