ubuntu下好用的虚拟串口工具

To install socat on Ubuntu (I'm using 12.04) just run the following command:

 
  1. # sudo apt-get install socat

Setting up two serial lines

now on a terminal window run socat

 
  1. # socat -d -d PTY PTY

The output should look like the following one:

 
  1. 2013/09/20 14:07:10 socat[6871] N PTY is /dev/pts/5
  2. 2013/09/20 14:07:10 socat[6871] N PTY is /dev/pts/6
  3. 2013/09/20 14:07:10 socat[6871] N starting data transfer loop with FDs [3,3] and [5,5]

Now you have two "serial" ports connected back to back

Testing the ports

open a new terminal and issue the following command

 
  1. # sudo cat /dev/pts/5

open a new terminal and issue the following command

 
  1. # sudo echo "Hello World" > /dev/pts/6

On the first terminal you should see the string "Hello World".

That's all,nothing more.

你可能感兴趣的:(嵌入式开发,AIOT,单片机,虚拟串口)