본문 바로가기

프로그래밍

tail 사용법

로그나 텍스트 파일의 마지막 부분을 확인하고자 할 때 사용함

 

tail example.txt 

> 텍스트의 마지막 10라인을 보여줌

 

tail -n 5 example.txt

> 텍스트의 마지막 5라인을 보여줌

 

tail -f example.txt

> 텍스트의 마지막 10라인을 보여주고 추가로 갱신되는 텍스트를 계속 보여줌 (실시간 로그 확인)

 

tail -f example.txt | grep "ancdesign"

> 텍스트의 마지막 10라인과 그 이후로 추가되는 라인에서 "ancdesign" 문자열이 있을 경우 보여줌

 

 

출처 링크 : https://www.linode.com/docs/tools-reference/tools/view-and-follow-the-end-of-text-files-with-tail/

 

View and Follow the End of Text Files with tail

tail is a Linux utility used to view the end of text files. This guide demonstrates the syntax and basic usage of tail, as well as showing how to use follow mode to view additions to files in real time.

www.linode.com