How To Check and Use Serial Ports Under Linux
Q. How do I check and configure serial ports under Linux for various purposes such as modem, connecting null modems or connect a dumb terminal?
A. Linux offers various tools. Linux uses ttySx for a serial port device name. For example, COM1 (DOS/Windows name) is ttyS0, COM2 is ttyS1 and so on.
Task: Display Detected System's Serial Support
Simple run dmesg command
$ dmesg | grep tty
Output:
[ 37.531286] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A [ 37.531841] 00:0b: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A [ 37.532138] 0000:04:00.3: ttyS1 at I/O 0x1020 (irq = 18) is a 16550A
setserial command
setserial is a program designed to set and/or report the configuration information associated with a serial port. This information includes what I/O port and IRQ a particular serial port is using, and whether or not the break key should be interpreted as the Secure Attention Key, and so on. Just type the following command:
$ setserial -g /dev/ttyS[0123]
Output:
/dev/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 4 /dev/ttyS1, UART: 16550A, Port: 0x1020, IRQ: 18 /dev/ttyS2, UART: unknown, Port: 0x03e8, IRQ: 4 /dev/ttyS3, UART: unknown, Port: 0x02e8, IRQ: 3
seserial with -g option help to find out what physical serial ports your Linux box has.
Linux serial console programs
Once serial ports identified you can configure Linux box using various utilities:
- minicom- The best friendly serial communication program for controlling modems and connecting to dump devices
- wvidial or other GUI dial up networking program - a PPP dialer with built-in intelligence.
- getty / agetty - agetty opens a tty port, prompts for a login name and invokes the /bin/login command.
- grub / lilo configuration - To configure serial port as the system console
Subscribe to our free e-mail newsletter or RSS feed to get all updates.
You can Email this page to a friend.
Related Linux / UNIX FAQ:
- Linux configure or enable serial console by editing GRUB boot loader
- OpenBSD Install Ports Collection
- How do I find out what ports are listening/open on my Linux/FreeBSD server?
- How do I install and search FreeBSD ports or a package?
- What ports need to be open for Samba to communicate with other windows/linux systems?
Leave a Reply
We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Please do not use the comment form to ask for help / question. Ask your question on the excellent Linux tech support forum. Thank you very much for stopping by our site!
Tags: agetty, dial up networking, dumb terminal, getty, linux serial port, linux serial port communication, linux serial port console, linux serial port monitor, modem, networking program, null modems, ppp dialer, serial communication program, serial port, serial port in linux, serial ports, serial support, uart 16550a ~ Last updated on: February 7, 2008



Recent Comments
Today ~ 1 Comment
Today ~ 2 Comments
Today ~ 44 Comments
Today ~ 6 Comments
Today ~ 7 Comments