Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当终端或控制台启动时/dev/ttyX,会为该实例创建一个文件。从那个给定的终端,是否可以通过命令检测ttyX正在使用的文件是什么?
/dev/ttyX
ttyX
If what you're looking for is a command, it's tty.
tty
你想要ttyname(3),这是 POSIX 标准的。
ttyname(3)