'console'에 해당되는 글 2건

  1. 2014.02.05 /dev/tty 와 /dev/console의 차이점
  2. 2012.04.12 콘솔상 동작 상태 애니메이션
리눅스/커널2014. 2. 5. 11:44

출처:http://chaoxifer-univ.blogspot.kr/2010/10/devtty-devconsole.html


/dev/tty 와 /dev/console의 차이점


There is a subtle difference between the console and the terminal. In a windowed environment, a tty terminal is associated with each shell session; in other words, each command line window such as an xterm is a separate terminal. Redirection to /dev/tty sends output to the active window. The console, on the other hand, is the screen. It is the monitor in general. Most windowing programs provide a special switch to the shell windows that will link /dev/console to the window instead of writing output directly on the screen. In any event, output can be redirected to these devices quite easily.



출처:http://unix.stackexchange.com/questions/60641/linux-difference-between-dev-console-dev-tty-and-dev-tty0


From the documentation:

/dev/tty        Current TTY device
/dev/console    System console
/dev/tty0       Current virtual console

In the good old days /dev/console was System Administrator console. And TTYs were users' serial devices attached to a server. Now /dev/console and /dev/tty0 represent current display and usually are the same. You can override it for example by adding console=ttyS0 to grub.conf. After that your /dev/tty0 is a monitor and /dev/console is /dev/ttyS0.

An exercise to show the difference between /dev/tty and /dev/tty0:

Switch to the 2nd console by pressing Ctrl+Alt+F2. Login as root. Type sleep 5; echo tty0 > /dev/tty0. Press Enter and switch to the 3rd console by pressing Alt+F3. Now switch back to the 2nd console by pressing Alt+F2. Type sleep 5; echo tty > /dev/tty, press Enter and switch to the 3rd console.

You can see that tty is the console where process starts, and tty0 is a always current console.




  • /dev/console is a virtual set of devices which can be set as a parameter at boot time. It might be redirected to a serial device or a virtual console and by default points to /dev/tty0. When multiple console= options are passed to the kernel, the console output will go to more than one device.

  • /dev/tty0 is the current virtual console

  • /dev/tty[1-x] is one of the virtual consoles you switch to with control-alt-F1 and so on.

  • /dev/tty is the console used by the process querying it. Unlike the other devices, you do not need root privileges to write to it. Note also that processes like the ones launched by cron and similar batch processes have no usable /dev/tty, as they aren't associated with any. These processes have a ? in the TTY column of ps -ef output.


'리눅스 > 커널' 카테고리의 다른 글

Machine 이름 알아내기  (0) 2014.04.03
early_param에 대해  (0) 2014.03.31
FrameBuffer size 구하기  (0) 2013.12.11
[커널] FB 문서  (0) 2013.12.09
[안드로이드][커널]Unknown symbol _GLOBAL_OFFSET_TABLE_  (0) 2013.08.09
Posted by code cat
프로그래밍2012. 4. 12. 10:24

출처: stackoverflow.com

콘솔상에서 간단하게 현재 상태가 진행 중 임을 알리는 progress animation이다.  우리가 흔히 카피중이거나 작업중에 볼 수 있는 형식이다.  정식으로는 쓰레드로 하나 돌리는게 맞겠지만, 어떻게 보면 프로세스가 무언가에 걸리고 있으면 애니메이션도 멈추는게 맞을지도 모르겠다.



실행하면 |,/,-,\, 를 반복한다.

Posted by code cat