“Date” Command in RedHat 8

Tanmay
2 min readSep 24, 2021

What is “date” command?

date” command is a command that is written in terminal(also called shell terminal) of Redhat Linux. As the name suggests, this command will give you present date. But that’s not all. This command will also give you present day and current time. But it has one limitation. The time you will see as the output of this command will be the time when this command was executed(i.e. even after 1 min, the output of the command will not change). To get current date and time, you will have to execute this command again. The basic syntax of this command is

date [option]….. [+format]

Use <man date> command, “man” manual of date command itwill show everything about date command as shown in below :-

There are many more options and format that date command supports. You can find all of them in <man date> command. Play with them and try to combine various options and formats with date command and see what output it’ll give you.

  1. date

2. date +%a > : This is use to display the in short way weekday name.

3. date +%A > : This is use to display the in full way weekday name.

4. date — date= “12 year ago” > to display the date and time of 12 year ago

5. date +%U > week number of year, with sunday as first day of week

6. date +%y > last two digit of year

7. date +%Y > To the display “YEAR”

8. date +%w > To display day of week

9. date +%x > To display locale ‘ s date representation

10 . date +%X > To display locale ‘ s date representation

--

--