현재 사용자만 pgrep

현재 사용자만 pgrep

pgrep현재 사용자에게만 작동하도록 하는 주장이 무엇인지 궁금합니다 . -u이름을 제공하게 되는데, 현재 사용자의 이름을 모르고 현재 사용자만 필요하다는 것만 알고 있습니다.

감사해요

답변1

UID를 사용할 수 있습니다또는이름은 다음에서 볼 수 있듯이 man pgrep:

   -u euid,...
          Only match processes whose effective user ID is listed.  Either the
          numerical or symbolical value may be used.

   -U uid,...
          Only match processes whose real user ID is listed.  Either the 
          numerical or symbolical value may be used.

둘 중 하나도 모른다면 명령 대체를 사용하십시오.

pgrep -u "$(whoami)"

관련 정보