Questions tagged [tty]
A representation of a device that asynchronously transmits and receives serial data.
922
questions
1530
votes
10
answers
472k
views
What is the exact difference between a 'terminal', a 'shell', a 'tty' and a 'console'?
I think these terms almost refer to the same thing, when used loosely:
terminal
shell
tty
console
What exactly does each of these terms refer to?
237
votes
8
answers
313k
views
Why do I need a tty to run sudo if I can sudo without a password?
I have configured sudo to run without a password, but when I try to ssh 'sudo Foo', I still get the error message sudo: sorry, you must have a tty to run sudo.
Why does this happen and how can I work ...
173
votes
3
answers
191k
views
Linux: Difference between /dev/console , /dev/tty and /dev/tty0
On a Linux system, what is the difference between /dev/console, /dev/tty and /dev/tty0?
What is their respective use and how do they compare?
148
votes
2
answers
154k
views
Difference between pts and tty
Possible Duplicate:
What is the exact difference between a 'terminal', a 'shell', a 'tty' and a 'console'?
I always see pts and tty when I use the who command but ...
136
votes
16
answers
593k
views
How to connect to a serial port as simple as using SSH?
Is there a way to connect to a serial terminal just as you would do with SSH? There must be a simpler way than tools such as Minicom, like this
$ serial /dev/ttyS0
I know I can cat the output from ...
86
votes
4
answers
24k
views
What are the responsibilities of each Pseudo-Terminal (PTY) component (software, master side, slave side)?
I am trying to figure out how a tty works1 (the workflow and responsibilities of each element). I have read several interesting articles about it, but there are still some blurry areas.
This is what I ...
69
votes
7
answers
228k
views
Can I change the font of the text-mode console?
I have a Unix-like OS installed without a windowing environment; i.e., just a text-mode console and no GUI.
Is it possible to change the font used by the console?
To be clear, I am not talking about ...
64
votes
2
answers
12k
views
Can a terminal emulator be as fast as TTY 1-6?
I've been trying various terminal emulators lately, from the built-in gnome-terminal, aterm, xterm, wterm, to rxvt. The test I've been doing is in this order:
Open up a tmux window with 2 panes
The ...
60
votes
8
answers
158k
views
How can I hook on to one terminal's output from another terminal?
I need to hook onto output of currently running terminal (tty1) from virtual terminal and capture it (running X server).
54
votes
1
answer
213k
views
How to read/write to tty* device?
I have a device that sends information over USB to my computer. Arch Linux sets up this device by creating a file named ttyUSB0 in /dev/. I have been using GTKterm to receive this incoming information ...
46
votes
2
answers
197k
views
How to find which serial port is in use?
The Question:
I plugged in a device (i.e. GSM modem) through a serial port (a.k.a. RS-232), and I need to see with which file in /dev/ filesystem this device was tied up, to be able to communicate ...
43
votes
4
answers
142k
views
How to switch between tty and xorg session
My xorg session is on tty1 and if I want to issue a command from tty (because I cannot do it from xorg session for some reasons), I press Ctrl+Alt+F2, for example, and type a command. But I cannot ...
43
votes
5
answers
75k
views
Start a process on a different tty
After about an hour of Googling this, I can't believe nobody has actually asked this question before...
So I've got a script running on TTY1. How do I make that script launch some arbitrary program ...
41
votes
3
answers
138k
views
set baud speed for tty
How do I set the baud speed for a specific tty (in this case a serial port)? I tried using
stty -F /dev/tty.iap ispeed 19200
But get the error Invalid argument for every speed I try (2400, 4800, ...
40
votes
6
answers
46k
views
How to get the tty in which bash is running?
In the second method proposed by this page, one gets the tty in which bash is being run with the command:
ps ax | grep $$ | awk '{ print $2 }'
I though to myself that surely this is a bit lazy, ...
40
votes
1
answer
4k
views
What happens when Ctrl + Alt + F<Num> is pressed?
I am looking for an explanation of what happens in Linux when this key combination is pressed to change the current terminal. In particular, what software component intercepts this key combination and ...
39
votes
1
answer
51k
views
Is it okay to disable requiretty?
I'm trying to set up a deploy script using Capistrano At a step cap deploy:setup script is connecting to my server and trying to run commands that create directories. Then I see an error: msudo: ...
36
votes
2
answers
20k
views
How does a Linux terminal work?
If you fire up a terminal and call an executable (assuming one that's line oriented for simplicity) you get a reply to the command from the executable. How does this get printed to you (the user)? ...
34
votes
1
answer
27k
views
What exactly is scrollback and scrollback buffer?
What are "scrollback" and "scrollback buffer" in programs like bash and screen, and how do they relate to the tty, the programs being run, and stdin/ stdout/ stderr?
Here is the only definition of "...
32
votes
3
answers
24k
views
Why does awk do full buffering when reading from a pipe [duplicate]
I'm reading from a serial port connected to a gps device sending nmea strings.
A simplified invocation to illustrate my point:
$ awk '{ print $0 }' /dev/ttyPSC9
GPGGA,073651.000,6310.1043,N,01436....
31
votes
2
answers
70k
views
What is the difference between ttyS0, ttyUSB0 and ttyAMA0 in Linux?
I want to know the difference between ttyS0, ttyUSB0 and ttyAMA0 on Linux.
30
votes
3
answers
3k
views
Do programs run from an ssh session depend on the connection?
Does a program that is run from an ssh session depend on the connection to the client? For example when the connection is really slow.
So does it actively wait until things are printed on the screen?
...
29
votes
11
answers
54k
views
How to stop cursor from blinking
How do I make the cursor stop blinking when in a TTY? (or anywhere else).
BONUS Points for one universal setting that stops the cursor blinking almost everywhere.
28
votes
5
answers
15k
views
Get ssh to forward signals
I want to be able to send signals (SIGINT is the most important) through ssh.
This command:
ssh server "sleep 1000;echo f" > foo
will start sleep on server and after 1000 seconds it will put 'f\...
27
votes
5
answers
23k
views
Rebinding/disabling CTRL+ALT+F# Virtual Terminal/Console Switching
I have an application that binds CTRL+ALT+F7, but my linux machine seems to catch the keystroke.
Is there a way to rebind/disable this key? A recompile of the kernel is an acceptable answer.
The ...
26
votes
2
answers
4k
views
Can the empty spaces/background in a terminal be replaced with a random(but pretty) pattern of ASCII characters?
Context and Question
There are many ways to colorize the terminal and shell environment. The output of individual commands, such as ls and grep, can also be colorized. Not directly related but ...
25
votes
2
answers
7k
views
GNU Screen weird characters on click
I have a small problem in GNU screen. A GNU screen session runs on my RaspberryPi. Now sometimes, when I join it, if I click in the terminal (I'm using terminator on Fedora) I see weird characters ...
25
votes
1
answer
7k
views
Make program in a pipe think it has tty [duplicate]
Test environment:
$ mkdir testdir
$ cd testdir
$ echo | tee "file
name"
Now, ls will print file?name (under Ubuntu GNU bash, at least), while ls | cat will print file and name in separate lines.
...
22
votes
10
answers
35k
views
How can I run `watch` as a background job?
When I run:
watch 'cmd >> output.txt' &
the job gets suspended by the system:
3569 Stopped (tty output)
Is there a workaround?
21
votes
6
answers
24k
views
Why are my virtual consoles completely blank?
When I go from my graphical session to a virtual console by Ctrl + Alt + F i (with i in 1 - 7 and 9-12) I see a completely black screen. Only on F8 I see the GUI. Not even a blinking coursor on the ...
20
votes
6
answers
27k
views
Show a notification across all running X displays
Using the command line, I'd like show a notification on every running X display. ( and running console )
Something like:
notify-send-all 'Warning' 'Nuclear launch in 5 minutes, please evacuate'
Is ...
20
votes
6
answers
11k
views
Construct a command by putting a string into a tty
I managed to do this
echo -n "command" > /dev/tty1
The letters appear, and the cursor moves, but they are "ghosts" – if you hit Enter, nothing happens (they are not in stdin).
Edit:
In the ...
19
votes
2
answers
10k
views
zshrc export GPG_TTY=$(tty) says not a tty
When I put export GPG_TTY=$(tty) in my .zshrc and restart terminal window and execute
echo $GPG_TTY
it says not a tty.
When I source .zshrc by
source ~/.zshrc && echo $GPG_TTY
it correctly ...
19
votes
2
answers
13k
views
What is `/dev/console` used for?
From this answer to Linux: Difference between /dev/console , /dev/tty and /dev/tty0
From the
documentation:
/dev/tty Current TTY device
/dev/console System console
/dev/tty0 Current ...
19
votes
1
answer
11k
views
In which cases is SIGHUP not sent to a job when you log out?
I read an answer from a user who claimed that running
foo 2>&1 >& output.log &
would result in foo continuing to run even when they log out. According to this user, this even ...
19
votes
2
answers
34k
views
How to close a tty
I've opened several ttys and I don't know the key combination to use to close a tty. I'm using Arch Linux.
19
votes
2
answers
25k
views
How to run builds in Docker containers from Jenkins
I am trying to use Jenkins to build a C++ project in a Docker container. I have no problem building in Jenkins, or building in a container outside of Jenkins.
Below is what I tried. I am omitting the ...
19
votes
1
answer
9k
views
TTY On External Monitor
When using my laptop at home, I usually use an external monitor, keyboard, and mouse with my laptop's screen as a second monitor. This is all easily configured using a nice GNOME utility that I ...
18
votes
4
answers
71k
views
Pseudo-terminal will not be allocated because stdin is not a terminal
I'm trying to set up automatic SSH hopping through a server which doesn't have nc.
This works from the command line:
ssh -A gateway ssh steve@target
(I have added my public key to the SSH agent).
...
18
votes
1
answer
3k
views
zsh can't input to terminal when piping stdin and stdout with variable command that has tty output
System info:
macOS Sierra 10.12.6
zsh 5.4.2 (x86_64-apple-darwin16.7.0)
GNU bash, version 4.4.12(1)-release (x86_64-apple-darwin16.3.0)
Scroll to the EXAMPLES at the bottom if you just want to dig ...
16
votes
2
answers
3k
views
How do interactive CLIs work?
How do command-line applications like Vim work? Specifically, how do they take control of the terminal in the manner they do? Also, for future reference, is there a specific term for applications that ...
16
votes
2
answers
2k
views
How does X11 interact with the kernel / perform login
As I understand for text-based interaction with the Linux kernel, a program called init starts getty (or agetty) which connects to one of the TTY devices under /dev and prompts for a username. After ...
16
votes
2
answers
30k
views
How to change tty login prompt?
To be clear, I am not referring to /etc/issue (shown before the prompt) or /etc/motd (shown after login), but the prompt itself, which is currently
hostname login:
For good measure, I am running ...
15
votes
2
answers
15k
views
How to get pinentry-curses to start on the correct tty?
I use gpg-agent for managing both PGP e SSH identities. The agent is started with a script like this
gpg_agent_env="$XDG_CACHE_HOME/gpg-agent.env"
export GPG_TTY="$(tty)"
if ! ps ...
15
votes
2
answers
8k
views
Detect if running in a virtual terminal?
I'd like to autologin to tty1 on login and then use vlock to lock it.
How can I detect from Bash if the current terminal is a console virtual terminal (e.g. tty1), so that I can put the vlock line ...
15
votes
1
answer
16k
views
What does '?' represent under TTY
If you run ps in your terminal, you may see something like the following:
What is ?? I'm ssh'ing into a Linux server, so I assume that it's just the sshd as it says under CMD, but I'm curious what ...
15
votes
2
answers
5k
views
How to get the real name of the controlling terminal?
How can one get the real name of the controlling terminal (if there is one, else an error) as a pathname?
By "real name", I mean not /dev/tty, which cannot be used by other arbitrary processes to ...
15
votes
2
answers
7k
views
Why are there so many virtual terminal devices?
I've been reading the Advanced Linux Programming book and it mentions about virtual terminals which, if I understood it correctly, it is a Linux-specific feature (not in Unix) to allow multiple login ...
15
votes
1
answer
4k
views
Screenshot of X from tty
Using Xvfb I can launch an application and take a screenshot.
What I'm wondering about is how to capture from an existing (dormant) X session.
Say from tty or over ssh.
From what I understand ...
14
votes
2
answers
26k
views
How to change the resolution after booting Arch Linux installation medium?
Is it possible to change the screen resolution after fully booting the Arch Linux installation medium? I tried to add vga=795 to the boot line, and that worked for a few lines before the resolution ...