Thursday, November 6, 2008

lsof command and some updates.

Today I came across a nice linux command here for listing open files on any device or mount point which is useful in following situation.

# umount /media/usbdisk/
umount: /media/usbdisk: device is busy

so it lists programs using files in that filesystem which you can kill and then unmount it.

Update: Shifted to Blogger in draft but editor is not that good, many things are still missing like
preview, spell-check, hindi script, etc. but has many new features like new page elements, exporting entire blog, etc.


praseidimio0904 said...

tusc and truss and pstack are some more handy tools.

Vinit said...

i didnt find tusc and truss commands on linux. These might be FreeBSD or other Unix commands.
On ubuntu, pstack is not installed by default so do,
"sudo apt-get install pstack"

Nice tool!

praseidimio0904 said...

strace is there on linux, tusc is replcement on HP-UX and truss is on Solaris.

Somebody must have ported tusc to Linux.

I am not sure If strace allows you to attach to a running process, tusc and truss do.

Vinit said...

Yes, strace does have option to attach to a running process,

"strace [-p pid]"

Also, one more interesting stuff, vim understands strace output format. Just set,

":set syntax=strace"

and see the magic.