When I am running Emacs from a terminal, how do I find out the tty device name from inside Emacs?
I first thought that it can be done with M-x shell-command RET tty RET
, but this does not work: instead of, e.g., /dev/tty1
, I get not a tty
.
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.
Sign up to join this communityWhen I am running Emacs from a terminal, how do I find out the tty device name from inside Emacs?
I first thought that it can be done with M-x shell-command RET tty RET
, but this does not work: instead of, e.g., /dev/tty1
, I get not a tty
.
(terminal-name) ; => "Mac
function by searching forterminal
withC-h f
, I'm not sure if it is related, I don't know what's the meaning of "tty" and "terminal".M-x shell-command
,M-x shell
andM-x ansi-term
don't use the same "terminal" as emacs itself, so running thetty
command inside emacs won't work. When I run emacs from a terminal emulator ,(terminal-name) ; => "/dev/tty"
, but thetty
command outputs/dev/ttys000
. – xuchunyang Jul 12 '19 at 16:50