0

I'd like to add a functionality to a project I'm working on, in which as soon as an external controller device powers on, it sends a time-request/command to a ttyusb port of an Ubuntu PC, and the Ubuntu PC sends back the system's time and date. Does such a command exists in Ubuntu?

for example something like:

'timeReq' > /dev/ttyUSB0

In which "time" is the command that would echo back the system's time

K7AAY
  • 17,705

1 Answers1

0

The command that outputs system time is date.

You can use format parameters to output only the time.

Also you can send its output to USB using > redirection.

Example

date +%R > /dev/ttyUSB0

The user needs to be a mamber of dialout group or have some other permissions to be able to write there.

You can use man date to see for other formatting options.

Pilot6
  • 92,041