Skip to content
Michel Blanc edited this page Mar 28, 2021 · 5 revisions

Welcome to the cats wiki!

Hu ? cats ?

cats is a serial port 'cat' utility.

It has few command line switches :

Usage : cats [-h] [-g __lvl__ ] [-b __baud__ ] [-t] __port__

  • h : shows help
  • __port__ : serial port (mandatory)
  • b __rate__ : serial baud rate (default : 9600)
  • t : write timestamp in front on each line
  • g __lvl__ : debug level, between 0 and 7 inclusive (default : no debug, see sys/syslog.h for levels)

Supported baud rates :

50 75 110 134 150 200 300 600 1200 1800 2400 4800 9600 19200 38400 57600 115200 230400 230400 460800 500000 576000 921600 1000000 1152000 1500000 2000000 2500000 3000000 3500000 4000000

Examples

  • Show what is received on /dev/ttyUSB0 at 19200 bauds :
$ cats -g7 -b19200 /dev/ttyUSB0
Hello world !
Hello world !
  • How long does it take to my ttyUSB1 connected NMEA GPS to get a 3D fix (A,3) :
$ cats -t /dev/ttyUSB1 | grep "GPGSA,A,3"
[27.130578]$GPGSA,A,3,05,10,07,25,,,,,,,,,8.81,5.74,6.69*08
  • Dump the cisco configuration to a file :
$ echo -e "enable cisco\nshow run\n" | cats /dev/ttyUSB2 > mycisco.cfg
  • Make an hexdump of serial port :
$ cats /dev/ttyUSB1  | hexdump -C
00000000  2c 30 36 2c 30 39 34 2c  31 38 2c 31 35 2c 32 39  |,06,094,18,15,29|
00000010  2c 32 38 38 2c 31 31 2a  37 39 0d 0a 24 47 50 47  |,288,11*79..$GPG|
00000020  53 56 2c 34 2c 33 2c 31  33 2c 32 31 2c 30 36 2c  |SV,4,3,13,21,06,|
00000030  33 32 39 2c 2c 32 34 2c  32 34 2c 32 38 38 2c 2c  |329,,24,24,288,,|
00000040  32 35 2c 31 33 2c 30 35  36 2c 33 33 2c 32 37 2c  |25,13,056,33,27,|
...

Questions ? Requests ?

Just a drop a note.

Contribs

Thanks @grevaillot for contribs.

Thanks @hugokernel for testing on MacOS.

And thanks @tofurky for the unique pull request :D

Clone this wiki locally