답변:
해당 프로그램은 ( "열린 파일 목록") 입니다.lsof
터미널을 열고을 입력 하면 열려있는 lsof
모든 파일의 거대한 목록이 표시되지만 대신 다음을 수행하여 하나의 명령으로 제한하십시오.
lsof -c gnome-terminal
다음을 입력하여 검색을 특정 디렉토리로 제한 할 수도 있습니다
lsof -c gnome-terminal -a +D /tmp
또는 열려있는 응용 프로그램을 포함하여 열려있는 모든 파일을 하나의 특정 디렉토리에 나열하십시오.
lsof /dev/urandom
수퍼 유저에 의해 시작되어 일부 프로세스 기억 루트 , 당신은 둘 필요가 있습니다 sudo
같은 과정 '열려있는 파일에 대한 자세한 정보를 얻을 수 있도록 명령 앞에.
검색 범위를 좁히기 위해 다음과 같은 grep
특정 줄을 지정할 수 있습니다 .
lsof /dev/urandom | grep chrome
출력의 FD
(File Descriptor) 열은 파일을 여는 프로그램의 목적에 대한 정보를 제공합니다 (현재 발생하고있는 것은 아님).
r
파일이 읽기 위해 열린다는 의미
w
파일이 쓰기 위해 열린다는 의미
u
읽기와 쓰기를 위해 파일이 열린다는 의미
자세한 내용은 매뉴얼 페이지 ( man lsof
)를 참조하십시오 . 또한 파일과 디렉토리를 찾아야하는 경우 Linux 파일 시스템 계층 표준 이 매우 유용합니다.
완전한 오버 킬 옵션이지만 실시간으로 작동하는 옵션으로 inotify를 사용할 수 있습니다.
sudo inotifywait -m -r /
이 작업은 많은 양의 메모리를 소비하며 설정하는 데 시간이 오래 걸립니다. 맨 페이지에서 말한 것처럼 :
-r, --recursive
Watch all subdirectories of any directories passed as arguments.
Watches will be set up recursively to an unlimited depth. Sym‐
bolic links are not traversed. Newly created subdirectories
will also be watched.
Warning: If you use this option while watching the root direc‐
tory of a large tree, it may take quite a while until all ino‐
tify watches are established, and events will not be received in
this time. Also, since one inotify watch will be established
per subdirectory, it is possible that the maximum amount of ino‐
tify watches per user will be reached. The default maximum is
8192; it can be increased by writing to /proc/sys/fs/ino‐
tify/max_user_watches.
또한 어떤 프로세스가 파일을 망쳐 놓는 지 알려주지 않지만 변경 사항이 발생할 때이를 식별하는 데 도움이 될 수 있습니다. "-e open"을 사용하면 실제로 사용량이 많은 시스템에서 일부 소음을 줄이는 데 도움이 될 수 있습니다.