Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Understanding lsof output

lsof seems to have duplicate entries for me.

1:fs:java      19644  4961      abc  mem       REG              252,1   126331  118159613 abc.jar
1:fs:java      19644  4962      abc  mem       REG              252,1   126331  118159613 abc.jar

lsof format is:

COMMAND     PID   USER   FD     TYPE            DEVICE   SIZE/OFF     NODE NAME

19644 is PID. abc is USER. what is 4961 and 4962? And why do we have 100s of these. Only difference among all of these is 3rd column 4961, 4962 and so on?

like image 683
Tarun Kumar Avatar asked Oct 15 '15 14:10

Tarun Kumar


1 Answers

From the lsof 4.89 man page: "-K selects the listing of tasks (threads) of processes, on dialects where task (thread) reporting is supported."

Version 4.89 of lsof on Ubuntu 16.04 can display a TID header using the -K flag.

$ lsof -K /usr/share/jenkins/jenkins.war
COMMAND  PID  TID    USER   FD      TYPE DEVICE SIZE/OFF NODE NAME
java    6533 6534 jenkins  cwd   unknown                      /proc/6533/task/6534/cwd (readlink: Permission denied)
java    6533 6534 jenkins  rtd   unknown                      /proc/6533/task/6534/root (readlink: Permission denied)
java    6533 6534 jenkins  txt   unknown                      /proc/6533/task/6534/exe (readlink: Permission denied)
java    6533 6534 jenkins    0u  unknown
like image 178
Zlemini Avatar answered Sep 19 '22 14:09

Zlemini