Can anyone explain what the purpose or how to use /dev/tty
You can start with the POSIX spec. From there, read about the "controlling terminal" of a process.
But just for example... /dev/tty is how a command like "ssh" can read your password even if its standard input comes from somewhere else:
tar cf - . | ssh dest 'tar xf -'
If ssh decides to prompt you for a password, it will read it from /dev/tty instead of stdin.
Conceptually, /dev/tty is "the keyboard and text terminal". More or less.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With