Command in Unix/Linux systems that allows you to set and print options for your terminal.
Questions tagged [stty]
103 questions
30
votes
1 answer
What does "stty raw -echo" do on OS X
When I try: $ stty raw -echo on my Terminal (Bash on OS X 10.6). It does stringe things and it's like the terminal hang there. Then I lookup the manual:
stty — set the options for a terminal device interface
raw (-raw)
If set, change the modes of…

Juanito Fatas
- 9,419
- 9
- 46
- 70
11
votes
2 answers
Terminal messed up (not displaying new lines) after running Python script
I have a Python script I use to execute commands in parallel across multiple hosts using the Python subprocess module. It wraps SSH, and basically makes a call like this:
output = subprocess.Popen(["/bin/env", env, "/usr/bin/ssh", "-t", "%s@%s" %…

blindsnowmobile
- 3,868
- 6
- 32
- 47
9
votes
1 answer
stty equivalent in windows
Does anybody know an equivalent tool for stty on Windows? I want to reverse engineer serial port settings on a Windows platform.
I have to port a Windows application to a Linux platform, but I do not have any information on the serial port settings…

Peter DW
- 486
- 3
- 13
8
votes
1 answer
jline2 print "^J" when it should print "\n" on a telnet console
I am using JLine 2 (v2.13) in conjunction with a Socket IO to create an admin console for my app which can be accessed via an ordinary telnet client. However I found it prints out strange symbols when it should print out a line…

Gelin Luo
- 14,035
- 27
- 86
- 139
8
votes
1 answer
symfony2 application, vagrant & ant: stty: standard input: Invalid argument
I am trying to move my development environment (symfony2 application) from my windows 7 localhost to a virtual machine using vagrant and the default ubuntu 10.04 64 bit machine. Everything is set up and it almost works, but there is one thing…

Sgoettschkes
- 13,141
- 5
- 60
- 78
7
votes
1 answer
How to write to serial port using PHP? Having an issue with buffering
EDIT: I have done some testing with the following script (found here: PHP serial port data return from Arduino). It appears that even using fwrite to /dev/ttyUSB0 outputs my new command plus the last command sent from the device. This makes me think…

Matt
- 251
- 4
- 13
7
votes
2 answers
What is the representation of the mac command key in the terminal?
Like control key is represented by a '^' in the terminal, what is the equivalent for the command key (mac)?
I am trying to remap my bash shortcuts using stty
For eg
stty eof ^D
But instead of control, I want to use the command key.
EDIT:
Okay so…

freethinker
- 1,286
- 1
- 10
- 17
6
votes
1 answer
Set stty parameters
Im trying to use bash to read from ttyS0 and need to set the following but im struggling to figure it out
databits = 7
stopbits = 2
parity = 0
flow control = 0
heres my code:
#!/bin/bash
# Port setting
stty -F /dev/ttyS0 raw speed 1200
#…

afro360
- 620
- 3
- 9
- 22
6
votes
3 answers
change the baud rate stty on MAC terminal
I need to use USB serial cable with baud rate of 115200.
I tried to set the rate with stty command from MACbook terminal application as follows;
$stty -f /dev/tty.usbserial-A103BTIB 115200
and confirmed the settings as follows;
$stty -f…

sandalwalk
- 91
- 1
- 1
- 7
5
votes
2 answers
Terminal in golang: syscall vs os/exec stty
This is how one can get a (POSIX) terminal size with a syscall in go:
func getTermDim() (width, height int, err error) {
var termDim [4]uint16
if _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(0), uintptr(syscall.TIOCGWINSZ),…

lyderic
- 382
- 3
- 7
5
votes
1 answer
Terminal input hidden after interrupting 'read -s'
Pressing Ctrl-C while waiting for input from operation read -sp returns operation back to command line but input given is hidden like it is still running read -s.
example
#!/bin/sh
sig_handler() {
echo "SIGINT received"
exit 1
}
trap…

Mike
- 53
- 3
5
votes
1 answer
Read from serial port and store in hexadecimal
I have a vhf radio which sent a status message continuosly through the serial port, and I need the messages that I got to be stored as hex data in a text file
I tried hexdump command as shown below, and the data that I've got from vhf radio is…

Latifa
- 131
- 1
- 1
- 4
5
votes
3 answers
Making a full screen Terminal application with Go
I'm trying to build a full screen terminal application. I'm using Go as my language of choice. I've figured out how to read from os.Stdin, but I'm unclear on how to clear the terminal window and manipulate the cursor position. I also want to capture…

Robert Hurst
- 8,902
- 5
- 42
- 66
5
votes
1 answer
RS232 console communication - set baudrate to 1 MBaud
Within a bash script, I use the following:
$ stty -F /dev/ttyUSB0 921600 raw
$ echo -n "some test data" >/dev/ttyUSB0
and it works as expected.
Using a PL2303 USB to RS232 adapter:
$ lsusb
...
Bus 006 Device 010: ID 067b:2303 Prolific Technology,…

Joe
- 3,090
- 6
- 37
- 55
5
votes
1 answer
stty: standard input: Invalid argument when using pdsh or ssh
I want to run a simple script from remote machine. The script contains the following:
#!/usr/bin/python
import os
print str(os.popen('stty size', 'r').read())
If I run it from local machine I get fine output, something like 36 138. If I try to run…

Omer Dagan
- 14,868
- 16
- 44
- 60