Question

I want to print in a log with the help of lsof the information about opened resources but I don't want the customer to see what libraries are used. I browsed through the lsof man page but I cannot get a hold of how I can exclude only the libraries from the output. Is there an easy method to do this?

Was it helpful?

Solution

you can use sed, awk, cut for parsing output of lsof, show only those lines, which doesn't have Lnn and ltx in their 4th field.

OTHER TIPS

You can exclude content from the output of lsof using it's -d flag along with it's negation character ^

For example, the following will prevent the txt file descriptor being displayed by lsof.

lsof -d '^txt'

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top