"/dev/tty"의 두 판 사이의 차이

잔글 (봇: 자동으로 텍스트 교체 (-<source +<syntaxhighlight , -</source> +</syntaxhighlight>))
 
(사용자 2명의 중간 판 9개는 보이지 않습니다)
1번째 줄: 1번째 줄:
==개요==
==개요==
;/dev/tty
;/dev/tty
*현재 콘솔 장치
* 현재 콘솔 장치
*현재 콘솔 세션
* 현재 콘솔 세션
* 로그인한 사용자의 터미널 장치
* fopen()으로 열어 터미널 장치로부터 데이터를 읽거나 쓸 수 있다.


==실습==
==실습==
<source lang='dos'>
<syntaxhighlight lang='console'>
[root@jmnote ~]# tty
[root@zetawiki ~]# tty
/dev/pts/2
/dev/pts/2
[root@jmnote ~]# echo hello > /dev/tty
[root@zetawiki ~]# echo hello > /dev/tty
hello
hello
</source>
</syntaxhighlight>


<source lang='dos'>
<syntaxhighlight lang='console'>
[root@jmnote ~]# useradd testuser
[root@zetawiki ~]# useradd testuser
[root@jmnote ~]# su - testuser
[root@zetawiki ~]# su - testuser
[testuser@jmnote ~]$ echo hello > /dev/tty
[testuser@jmnote ~]$ echo hello > /dev/tty
hello
hello
</source>
</syntaxhighlight>
:→ /dev/tty는 자신의 콘솔이므로 root 권한이 없어도 입력가능
:→ /dev/tty는 자신의 콘솔이므로 root 권한이 없어도 입력가능


==같이 보기==
==같이 보기==
*[[/dev/pts/0]]
*[[/dev/pts/0]]
*[[tty]]
*[[리눅스 tty]]


==참고 자료==
==참고==
*http://unix.stackexchange.com/questions/60641/linux-difference-between-dev-console-dev-tty-and-dev-tty0
*http://unix.stackexchange.com/questions/60641/linux-difference-between-dev-console-dev-tty-and-dev-tty0


[[분류: /dev]]
[[분류: /dev]]

2020년 12월 7일 (월) 21:30 기준 최신판

1 개요[ | ]

/dev/tty
  • 현재 콘솔 장치
  • 현재 콘솔 세션
  • 로그인한 사용자의 터미널 장치
  • fopen()으로 열어 터미널 장치로부터 데이터를 읽거나 쓸 수 있다.

2 실습[ | ]

[root@zetawiki ~]# tty
/dev/pts/2
[root@zetawiki ~]# echo hello > /dev/tty
hello
[root@zetawiki ~]# useradd testuser
[root@zetawiki ~]# su - testuser
[testuser@jmnote ~]$ echo hello > /dev/tty
hello
→ /dev/tty는 자신의 콘솔이므로 root 권한이 없어도 입력가능

3 같이 보기[ | ]

4 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}