[oclug] how to get a process's tty
patsmith at pobox.com
Thu Apr 8 22:18:42 EDT 2004
Francis J. A. Pinteric wrote:
> Look at the /proc/<pid>/fd directory. Using an `ls -l' command on that
> directory will give you all the file descriptors used by that process.
> I'll leave it as an exercise for the reader to extract the device name.
This would usually work, but not always. Provided one can identify the
ttys in the list, of course.
A process need not have its controlling terminal open.
More information about the OCLUG