Anyone care to make a dotpup of lsof (LiSt Open Files)?

What features/apps/bugfixes needed in a future Puppy
Post Reply
Message
Author
kethd
Posts: 451
Joined: Thu 20 Oct 2005, 12:54
Location: Boston MA USA

Anyone care to make a dotpup of lsof (LiSt Open Files)?

#1 Post by kethd »

Studying I/O redirection, it seems like lsof (LiSt Open Files) is the proper utility to see what is going on. (The advanced BASH documentation uses it.) But I can't find it anywhere yet in the pupverse, and I haven't learned enough yet to be able to compile it from raw sources myself.

Would someone be willing to make it some kind of pup-pkg? Any suggestions of where I could steal a binary from some other distro that is likely to work?

What existing pup utilities give the best detailed information about open files?

= = = =
LiSt Open Files is a useful and powerful tool that will show you opened files. In Unix everything is a file: pipes are files, IP sockets are files, unix sockets are files, directories are files, devices are files, inodes are files...

http://people.freebsd.org/~abe/
http://freshmeat.net/projects/lsof/
http://www.akadia.com/services/lsof_intro.html
http://www.uwsg.iu.edu/UAU/advcomm/lsof.html
http://rootprompt.org/article.php3?article=9390

lsof
List open files. This command outputs a detailed table of all currently open files and gives
information about their owner, size, the processes associated with them, and more. Of course,
lsof may be piped to grep and/or awk to parse and analyze its results.
bash$ lsof
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
init 1 root mem REG 3,5 30748 30303 /sbin/init
init 1 root mem REG 3,5 73120 8069 /lib/ld-2.1.3.so
init 1 root mem REG 3,5 931668 8075 /lib/libc-2.1.3.so
cardmgr 213 root mem REG 3,5 36956 30357 /sbin/cardmgr
...

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

Re: Anyone care to make a dotpup of lsof (LiSt Open Files)?

#2 Post by Lobster »

using lsof
http://dmiessler.com/study/nix/commands/lsof/
kethd wrote:
What existing pup utilities give the best detailed information about open files?
Start / Control Panel / KP Running packages

- I know you are interested in command line tools but this is still useful . . .

How this is used: Sometimes (this happens with Firefox after I have about 6 open) programs are in memory but not on the desktop - you can use this to "kill 'em"
It takes a while to realise that you can clear from memory without rebooting (refresh often works too - that is just restarting JWM)
You will often notice more of a program running than is actually the case - a bug? I have heard no but am not convinved . . . 8)
Last edited by Lobster on Thu 14 Sep 2006, 23:12, edited 1 time in total.
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

GuestToo
Puppy Master
Posts: 4083
Joined: Wed 04 May 2005, 18:11

#3 Post by GuestToo »

You will often notice more of a program running than is actually the case
if you mean there seem to be duplications of a process in kp or when you type ps, ps can't tell the difference between a process and a thread, so it lists all running processes and threads together

for example:

1124 root 42640 S /mnt/hda11/pup4/firefox/firefox-bin
1126 root 42640 S /mnt/hda11/pup4/firefox/firefox-bin
1127 root 42640 S /mnt/hda11/pup4/firefox/firefox-bin
1131 root 42640 S /mnt/hda11/pup4/firefox/firefox-bin

is one process (pid 1124) and 3 threads (pids 1126, 1127 and 1131)

notice they all show the same amount of memory being used ... the process and all it's threads is using 42 megs of memory ... not 42 megs of memory for each thread

killing the process (pid 1124) will kill all the threads too

url 1 ... url 2

GuestToo
Puppy Master
Posts: 4083
Joined: Wed 04 May 2005, 18:11

#4 Post by GuestToo »


kethd
Posts: 451
Joined: Thu 20 Oct 2005, 12:54
Location: Boston MA USA

#5 Post by kethd »

THANK YOU, GuestToo!

I was nervous about the "i686" label, since I am running on PI (233-MMX), but that binary actually seems to work! Now I can pursue my crazy efforts to understand pipes, fifos, and IO-redirection...

(And that source package seems way past my current level -- I've never compiled anything in Linux, and I assume I would need the Puppy development package to compile lsof?)

Getting a list of all these open file details is wonderful. Too bad the lsof binary is 100K. Probably too big for standard image.gz, or standard usr_cram.fs. But maybe worth including in the standard development cram.fs.

Post Reply