Linux

top 로그로 남기기

구차니 2023. 10. 17. 19:44

top이 ncurse로 만들어져서

원하는 내용만 파일로 로그 남기기가 쉽지 않다

 

아래처럼 하면 1초에 1번 top을 실행해서 top.log에 쭈욱 쌓아둘수 있다.

$ top -b -d 1 > top.log

 

batch의 b

       -b  :Batch-mode operation
            Starts top in Batch mode, which could be useful for sending output
            from  top  to other programs or to a file.  In this mode, top will
            not accept input and runs until the iterations  limit  you've  set
            with the `-n' command-line option or until killed.

[링크 : https://qkr3232.tistory.com/136]