Last updated on July 2, 2020 by Dan Nanni
First of all, let's assume that you have already connected the serial port of your Linux box to a switch console port via a serial cable.
To connect a Linux terminal to the serial port of your Linux system, you can use a command-line screen manager tool called screen
.
screen
on LinuxTo install screen
on Ubuntu, Debian or Linux Mint:
$ sudo apt-get install screen
To install screen
on CentOS, Fedora, or RHEL:
$ sudo yum install screen
screen
utilityTraditionally in Linux, the first serial port (COM1) is assigned a name /dev/ttyS0
, the second serial port (COM2) assigned /dev/ttyS1
, etc. If you specify a serial port name as the first argument of the screen
command, the current terminal window where you run screen
will be directly connected to the serial port.
Thus, to connect to a serial port, simply run the following command from a terminal:
$ screen /dev/ttyS0
Optionally, you can specify baud rate (e.g., 1200, 9600, 19200) as the second parameter as follows.
$ screen /dev/ttyS0 9600
Once connected to a serial port, you will then be able to access the switch console port from the terminal.
To terminate the current screen
session, type Ctrl-A
+k
. If you want to temporarily detach from the screen
session, type Ctrl-A
+d
. After detached, you can re-attached to the session later by running:
$ screen -r
This website is made possible by minimal ads and your gracious donation via PayPal or credit card
Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.
Xmodulo © 2021 ‒ About ‒ Write for Us ‒ Feed ‒ Powered by DigitalOcean