I am using Ubuntu 20.04.3 LTS. I am trying to monitor the serial port connect with my arduino. I have seen my friend using following command (he performed it in my laptop):
tail -f {dmesg,syslog} | grep -i tty
And whenever I plugin and unplug the arduino, the terminal always keep up showing serial port name, its condition. But when I try it myself, it says that there is not such file or directory. I have search and tried following command:
tail -f var/log/dmesg
tail -f var/log/{dmesg,syslog}
But it seems like it does not show up the serial port or keep up with condition. Would you help me with any ideas?
CodePudding user response:
You can use
dmesg -W | grep -i tty
-w, --follow
Wait for new messages. This feature is supported only on systems with a readable /dev/kmsg (since kernel 3.5.0).
So Output will be something like this
rexter@rexter:/media/rexter/REXDRIVE$ dmesg -w | grep -i tty
[ 0.112876] printk: console [tty0] enabled
[ 332.500320] Bluetooth: RFCOMM TTY layer initialized
If you want to get only new message and want to hide the old ones then use -W
-W, --follow-new
Wait and print only new messages.
Bonus:
Use -T
to get the time stamp so that you can get the time when you receive the log.
Thank you :)