惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - Franky
U
Unit 42
MyScale Blog
MyScale Blog
B
Blog
阮一峰的网络日志
阮一峰的网络日志
量子位
IT之家
IT之家
The GitHub Blog
The GitHub Blog
F
Fortinet All Blogs
Recent Announcements
Recent Announcements
V
Visual Studio Blog
G
Google Developers Blog
Last Week in AI
Last Week in AI
雷峰网
雷峰网
博客园 - 聂微东
博客园 - 叶小钗
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
J
Java Code Geeks
博客园 - 司徒正美
Y
Y Combinator Blog
T
The Blog of Author Tim Ferriss
月光博客
月光博客
aimingoo的专栏
aimingoo的专栏

Ittavern.com

Wimage - Hosting Open-Source Image Uploader with Podman and external S3 Storage Switching from Hugo to picopaper Encryption using SSH Keys with age in Linux ETag in nginx - Simple Resource Caching Sending nginx Logs to Loki with Grafana Alloy How to: Cisco ISE backup to SFTP repository with public key authentication Dummy IP & MAC Addresses for Documentation & Sanitization Deploying ISSO Commenting System for Static Content using Docker Generate a Vanity v3 Hidden Service Onion Address with mkp224o ssh-audit Primer - Audit your SSH Server mtr - More Detailed Traceroute - Network Troubleshooting My Personal Backup Strategy - August 2024 iperf3 - User Authentication with Password and RSA Public Keypair Adding a trash can to Linux with trash-cli Bandwidth Measurement using netcat on Linux Getting started with rsync - Comprehensive Guide Cron Jobs on Linux - Comprehensive Guide with Examples SSH Server Hardening Guide v2 Port Knocking with knockd and Linux - Server Hardening Getting started with rclone - Data transmission Getting started with dig - DNS troubleshooting Getting started with Fail2Ban on Linux Getting started with netcat on Linux with examples URL explained - The Fundamentals Troubleshooting Asking The Right Questions Create tmux layouts using bash scripts Getting started with tcpdump - Ittavern.com Curl on Linux - Reference Guide Getting started with nmap scripts My Offsite Backup - March 2023
Linux - connect to a serial port with screen
2022-12-09 · via Ittavern.com

There are a bunch of programs out there, that can get you connected to a serial port of a switch, but using screen was the best and easiest solution I've found. Works perfectly in the CLI, can be run in the background, and easy to set up - if it is not already installed.

It worked with various combinations of serial-to-usb-cables, Cisco switches, and Linux machines. Let us start with the command itself:

  • sudo screen /dev/ttyUSB0 9600
    • sudo screen - run screen as sudo
    • /dev/ttyUSB0 - the tty number of the usb cable / adapter
    • 9600 - the speed of the serial connection

You can kill the session with CTRL + a, then k, and confirm it with y.

Finding the device / the tty number #

Find the tty number while you are already connected:

sudo dmesg | grep tty

Output:

kuser@pleasejustwork:~$ sudo dmesg | grep tty
[    0.134050] printk: console [tty0] enabled
[1724834.635665] usb 3-1: FTDI USB Serial Device converter now attached to ttyUSB0

Shows the device while plugging it in:

sudo dmesg -wH | grep tty

Output:

kuser@pleasejustwork:~$ sudo dmesg -wH | grep tty
[sudo] password for kuser: 
[  +0,000022] printk: console [tty0] enabled
[  +0,001283] usb 3-1: FTDI USB Serial Device converter now attached to ttyUSB0

This is helpful if you are connected to multiple devices.

Finding the correct speed #

I haven't had to change this yet, but just in case:

sudo stty -F /dev/ttyUSB0

Output:

kuser@pleasejustwork:~$ sudo stty -F /dev/ttyUSB0
speed 9600 baud; line = 0;
-brkint -imaxbel