How to Shell Display Current Time

You can use the date command in the shell to display the current time. By default, the date command will display the current date and time in a standard format. Here is an example:

date

The output may look something like:

Mon Aug 23 14:17:50 UTC 2021

If you want to display the time in a specific format, you can use the options of the “date” command to specify the format. For example, to display the time in a 24-hour format, you can use the +%T option.

date +%T

The output result may be similar to:

14:17:50

There are many other options available for customizing the output format of the date command, you can refer to the documentation of the date command for more information.

bannerAds