Can someone explain to me that the target is / dev / tty

Can someone explain what purpose or how to use / dev / tty

+3
source share
3 answers

You can start with the POSIX spec . From there, read about the "control terminal" of the process.

But simple, for example ... / dev / tty: how the ssh command can read your password, even if its standard input comes from somewhere else:

tar cf - . | ssh dest 'tar xf -'

If ssh decides to request a password, it will read it / dev / tty instead of stdin.

Conceptually, / dev / tty is a “keyboard and text terminal”. More or less.

+5
source

" ", , stdin, stdout stderr . .

+1

If stdin is already configured as a channel, you can use / dev / tty to emulate the readings from the control input terminal device.

For instance:

echo ~/.profile ~/.bashrc | xargs sh -c 'vim "$@" </dev/tty' dummy_script_name
# :qa  # quit all files

See: After running grep and passing it to vim and then logging out, why am I experiencing this incomprehensible console crash?

0
source

All Articles