Serial Terminal Basics
Command Line (Windows, Mac, Linux)
As mentioned earlier, you can use command line interfaces to create serial connections. The major limiting factor is the lack of connection options. Most of the programs we've discussed so far have a slew of options that you can tweak for your specific connection, whereas the command line method is more of a quick and dirty way of connecting to your device in a pinch. Here's how to accomplish this on the three major operating systems.
Terminal and Screen (Mac, Linux)
Open Terminal. See the Connecting to Your Device section for directions.
ls /dev/tty.* to see all available ports.
You can now use the
screen command to to establish a simple serial connection.
screen <port_name> <baud_rate> to create a connection.
The terminal will go blank with just a cursor. You are now connected to that port!
To disconnect, type
control-a followed by
control-\. The screen will then ask if you are sure you want to disconnect.
There are other options you can control from screen, however it is recommended that you only use this method if you are comfortable with the command line. Type
man screen for a full list of options and commands.
screen command can also be used in Linux. There are only a few variations from the Mac instructions.
If you do not have screen installed, get it with
sudo apt-get install screen.
Making a connection is the same as Mac.
To disconnect, type
That's all there is to it.
MS-DOS Prompt (Windows)
The fastest way to get to the command line in Windows is to click on the start menu, type
cmd into the search field, and press Enter.
This will open up a blank MS-DOS command line prompt.
To be able to issue Serial commands, you must first enter PowerShell. Type
powershell to get into PowerShell command mode.
To see a list of all the available COM ports, type
You should now see something like this..
Now create an instance of the port you want with this command
$port= new-Object System.IO.Ports.SerialPort COM#,Baudrate,None,8,one
With that, you can now connect to and send data to or from that COM port.
Again, this method of serial communication is only recommended for advanced command line users.