In Ubuntu system, you can use the following command to output the current time:
date
This command will display the complete current date and time, including the day of the week, month, date, specific time, and time zone information.
If you only need the time part, you can use the format parameter:
date +"%H:%M:%S"
This will output a 24-hour format time like 14:35:22.
Other commonly used time formatting methods:
date +"%I:%M:%S %p"- 12-hour format time with AM/PM indicatordate +"%T"- Equivalent to%H:%M:%Sdate +"%X"- Displays the time representation format of the current locale