본문 바로가기
Linux

linux command - ac

by 도경다경 2023. 5. 12.
반응형

ac는 사용자가 얼마나 접속했는지 알려주는 명령어 입니다.
단위는 (분) 입니다.

옵션은 다음과 같습니다.

       ac     [ -d | --daily-totals ] [ -y | --print-year ]
              [ -p | --individual-totals ] [ people ]
              [ -f | --file filename ] [ -a | --all-days ]
              [ --complain ] [ --reboots ] [ --supplants ]
              [ --timewarps ] [ --compatibility ]
              [ --tw-leniency num ] [ --tw-suspicious num ]
              [ -z | --print-zeros ] [ --debug ]
              [ -V | --version ] [ -h | --help ]

 

설명대로라면  wtmp파일을 기초로 하고 있네요. 당연히 wtmp 보관주기에 따라 출력 기간이 달라집니다.

일반적으로 ac -dp 이렇게 사용하여 계정별, 일자별 접속기간을 한눈에 볼 수 있습니다.
인터넷을 뒤져보니 대부분 숫자 단위가 무엇인지 표기 안하는 걸 보니 테스트는 안해본 것 같습니다.
숫자가 소수점 2자리까지 나옵니다.

출력은

       계정          시간
월  일   total     시간

이런 식입니다.

누가 몇 일 얼마나 접속해 있었는지 급하게 볼 때 유용한 커맨드 인 것 같습니다.

 

DESCRIPTION

       ac prints out a report of connect time (in hours) based on the
       logins/logouts in the current wtmp file.  A total is also printed
       out.

       The accounting file wtmp is maintained by init(8) and login(1).
       Neither ac nor login creates the wtmp if it doesn't exist, no
       accounting is done.  To begin accounting, create the file with a
       length of zero.

       NOTE:  The wtmp file can get really big, really fast.  You might
       want to trim it every once and a while.

       GNU ac works nearly the same UNIX ac, though it's a little
       smarter in several ways.  You should therefore expect differences
       in the output of GNU ac and the output of ac's on other systems.
       Use the command info accounting to get additional information.
반응형

'Linux' 카테고리의 다른 글

linux command - apropos  (1) 2023.05.12
linux command - alias  (0) 2023.05.12
systemd 서비스 타입 Simple or Oneshot  (0) 2023.04.26
multithread enable, on 확인 방법  (0) 2023.04.26
Prometheus + Grafana 를 활용한 시스템 모니터링  (0) 2023.04.17

댓글