텍스트 파일을 열고 자체 업데이트 방식과 유사 합니다. 로그 파일을 열고

텍스트 파일을 열어서 스스로 업데이트하도록하려면 어떻게해야합니까? top작동 방식과 유사 합니다.

로그 파일을 열고 즉시 업데이트되는 것을보고 싶습니다.

방금 시도했습니다.

$ tail error.log

그러나 로그 파일의 행만 표시한다는 것을 깨달았습니다.

RHEL 5.10을 사용하고 있습니다



답변

찾고있는 tail -f error.log(의 man tail) :

   -f, --follow[={name|descriptor}]
          output appended data as the file grows; -f, --follow, and --fol‐
          low=descriptor are equivalent

그러면 파일을보고 변경된 사항을 볼 수 있습니다.


답변

스크롤 백 및 검색에 “꼬리”대신 “less”를 사용하십시오.

tail -f error.log또는 더 잘 사용할 수 있습니다 tail -F error.log..

그러나 파일에서 뒤로 스크롤하려면 유용하지 않습니다.

less +F error.log

당신의 기능을 얻을 tail -f,
수 있지만 중단 과 새로운 입력의 읽기 Ctrl+를 C.

그런 다음, 당신은 정상에있는 less모드로,
당신은 할 수 다시 스크롤 당신이 놓친 것을보고 Up/ Down
또한, 사용, 포장없이 긴 로그 파일 라인을 읽을 수 있습니다 Left/Right

검색하고 일치하는 줄만 표시

또한 정규식을 검색 할 수 있습니다 /, ?이전 버전에 대한, n그리고 N다음에 / 이전.

로그 파일에 대한 매우 흥미로운 당신이 할 수 있다는 것입니다 숨길 수 있는 검색 일치하지 않는 모든 라인을 &, 필터링 에만 일치를.

명령 행의 키

F내부 less, 당신은 계속tail -f -like 모드. 명령 줄에서 수단 “직접 적은 시작한 후 Enter 키를 눌러이 키”.
+less +F

따라서 F시작시 키 누르기 를 사용 했습니다.

F  Scroll  forward,  and  keep trying to read when the end of file is
   reached.  Normally this command would be used when already at  the
   end  of the file.  It is a way to monitor the tail of a file which
   is growing while it is being viewed.  (The behavior is similar  to
   the "tail -f" command.)

multitail둘 이상의 로그 파일을보아야하는 경우 도 참조하십시오 .


답변

다음 -f과 함께 옵션 사용 tail:

-f, –follow [= {name | descriptor}] 파일이 증가함에 따라 추가 된 데이터를 출력합니다. -f, –follow 및 –follow = descriptor는 동일합니다

또는 F내부에서 명령을 사용하십시오 less.

   F      Scroll forward, and keep trying to read when the end of file is reached.  Normally this command would be used when already at the end of the file.  It is a way to mon‐
          itor the tail of a file which is growing while it is being viewed.  (The behavior is similar to the "tail -f" command.)


답변