Bash: Display Current Date

How do I display the current date under Bash UNIX / Linux / OS X shell?

Use the date command to dispkay or set system date and time. Invoking date command with no FORMAT argument is equivalent to invoking it with a default format that depends on the LC_TIME locale category. Open a command-line terminal (select Applications > Accessories > Terminal), and then type the following command:
$ date
Sample outputs:

Tue Dec  7 03:08:34 IST 2010

To display the date of the day before yesterday, enter:
$ date --date='2 days ago'
To display the date of the day three months and one day, enter:
$ date --date='3 months 1 day'
To display the current full month name and the day of the month:
$ date '+%B %d'
Anytime you need assistance with date command, turn to the man or info pages first. They give you detailed information, parameters and switches for date command. Just type man followed by the name of the command (i.e. date) to open the appropriate man page. For example, man date opens the man page for the date command:
$ man date
OR (may not work on OS X and other UNIX like systems)
$ info date

Posted by: SXI ADMIN

The author is the creator of SXI LLC and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post

How to Make Website WCAG Compliant?

Next Post

Link download Kali Linux 2020.1 (ISO + Torrent)

Related Posts