FAQ Database Discussion Community


How to output to the currently visible terminal

c++,c,linux,tty
I want to output some text as response to the signal SIGUSR1 I.e. a user sends kill -USR1 <pid> to a process started in background or in another terminal. I would like to get some output in the terminal where kill was invoked. How can I achieve this?...

how to open /dev/console in C

c,tty
I was reading wayland/weston code, the setting up tty part. I found it tries to acquire an available tty for doing KMS and start windows. This is how it does: if (!wl->new_user) { wl->tty = STDIN_FILENO; } else if (tty) { t = ttyname(STDIN_FILENO); if (t && strcmp(t, tty) ==...

How can I send terminal escape sequences through SSH with Go?

bash,ssh,go,tty
I'm writing a Go program that will connect to a host via SSH using the native x/crypto/ssh library and drop an interative shell. I'm using RequestPty(), but the (bash) shell on the remote end does not behave as expected with control codes. When I enter various control characters, they're echoed...

egrep to list devices in /dev directory

grep,ubuntu-12.04,tty
I am using following command in my Python code to list devices available in /dev directory: devices = ["/dev/" + x for x in os.popen("ls /dev/ | egrep -i 'ttyUSB|ttyS'").read().strip().split('\n')] How can I modify it to find only ttyS0 and ttyS1? Currently it returns all ttyS s : ttyS0,ttyS1, ttyS11,...

Filter out command that needs a terminal in Python subprocess module

python,terminal,subprocess,tty
I am developing a robot that accepts commands from network (XMPP) and uses subprocess module in Python to execute them and sends back the output of commands. Essentially it is an SSH-like XMPP-based non-interactive shell. The robot only executes commands from authenticated trusted sources, so arbitrary shell commands are allowed...

Get both console and tty after upgrade Debian to Jessie 8.0 in openvz

console,debian,tty,openvz,proxmox
I can not use this machine via proxmox's console, because there are both console and tty, I confirmed that this problem came after dist-upgrade!...

Disable DSUSP in Python

python,osx,tty,fcntl,termios
An OSX user submitted a bug that CTRL+Y causes a python terminal application to be suspended, via dsusp causing SIGTSTP to be sent when the Python program tried to read on stdin. The code below to solves the problem: (context) import sys import termios if sys.platform == 'darwin': attrs =...

bash prompt shell displayed differently in terminal and tty console

bash,terminal,console,tty,ps1
This is a portion of my ~/.bashrc: prompt(){ local EXIT="$?" # return code PS1="" local red="\[\033[0;31m\]" # text colour local purple="\[\033[0;35m\]" # text colour local normal="\[\033[0m\]" # text colour if [ $EXIT == 0 ]; then # $EXIT colour based upon its value local return="${normal}${?}" else local return="${red}${?}${normal}" fi PS1+="${normal}[${purple}\\D{%-l:%M%P}${normal}]${return}...

Why can't I open/write from a serial port on Android?

android,serial-port,file-permissions,android-4.4-kitkat,tty
I have written an Android app which runs on a custom kernel on Android 4.4 Kitkat device, which uses the Android Serial Port API (https://code.google.com/p/android-serialport-api/) in order to open the serial port "/dev/ttyACM0" which is the port associated with my serial device. The port has the proper "666" permissions (crw-rw-rw),...

How to hijack the input stream of tty1 in a ssh session?

linux,ssh,tty
I have a pi that is connected to my TV via hdmi. It's setup to automatically login at boot to the console (not x-windows). In order to control the screen's output on my TV, I must use the keyboard connected to my pi. I want to be able to login...

Common commands to show up on startup of Terminal (OSX)?

osx,terminal,tty
I'm learning how to use Terminal on my Mac (10.10), and I want to have a short list of common commands that I've learned show up when I start a new tty session. Just for a few important navigational commmands that I keep on forgetting. Is there a way to...

Process that toggles other's permission to write to your terminal [Unix] [C]

c,unix,terminal,tty
I'm working on a process that lets a user allow or disallow others from writing to their terminal. Below is what I have but it does not appear to be working, I'm not sure why. If anybody could point me in the right direction I would appreciate it. #include <stdio.h>...

STM32F0-Discovery: no tty

linux,stm32,tty,usbserial,usart
I am currently trying to send data to my STM32F0308 board via USART. The data is supposed to be sent by a Python script using PySerial. However, when I plug in the board, I cannot find the corresponding /dev/ttyXXXX. The board is branched and I can flash code on it...