View all file descriptors owned by a process

sudo lsof -p `sudo ps aux | grep -i neo4j | grep -v grep | awk '{ print $2 }'`
Inner "ps...grep..." command searches for a process matching the specified . "lsof -p lists all file descriptors owned by . Includes open files, sockets, devices, etc...
Sample Output
lr-x------ 1 neo4j nogroup 64 Jun  2 09:30 0 -> /dev/null
l-wx------ 1 neo4j nogroup 64 Jun  2 09:30 1 -> /var/log/neo4j/console.log
lr-x------ 1 neo4j nogroup 64 Jun  2 09:30 10 -> /usr/share/neo4j/lib/neo4j-jmx-1.9.jar
lrwx------ 1 neo4j nogroup 64 Jun  2 09:30 100 -> socket:[29257]
lrwx------ 1 neo4j nogroup 64 Jun  2 09:30 102 -> /var/lib/neo4j/data/graph.db/index/lucene/node/nameSearch/write.lock
lrwx------ 1 neo4j nogroup 64 Jun  2 09:30 104 -> /var/lib/neo4j/data/graph.db/index/lucene/node/Actor/write.lock
lrwx------ 1 neo4j nogroup 64 Jun  2 09:57 105 -> /var/lib/neo4j/data/graph.db/index/lucene/node/Actor/_c.fdt
lrwx------ 1 neo4j nogroup 64 Jun  2 09:30 106 -> /var/lib/neo4j/data/graph.db/index/lucene-store.db
lrwx------ 1 neo4j nogroup 64 Jun  2 09:30 107 -> /var/lib/neo4j/data/graph.db/index/lucene.log.1
lr-x------ 1 neo4j nogroup 64 Jun  2 09:30 108 -> /usr/lib/jvm/java-6-sun-1.6.0.45/jre/lib/jsse.jar
lr-x------ 1 neo4j nogroup 64 Jun  2 09:30 109 -> /usr/lib/jvm/java-6-sun-1.6.0.45/jre/lib/ext/sunjce_provider.jar
lr-x------ 1 neo4j nogroup 64 Jun  2 09:30 11 -> /usr/share/neo4j/lib/neo4j-kernel-1.9.jar
lrwx------ 1 neo4j nogroup 64 Jun  2 09:30 110 -> /var/lib/neo4j/data/rrd
l-wx------ 1 neo4j nogroup 64 Jun  2 09:30 111 -> /var/log/neo4j/http.log
lr-x------ 1 neo4j nogroup 64 Jun  2 09:30 112 -> pipe:[29804]
l-wx------ 1 neo4j nogroup 64 Jun  2 09:30 113 -> pipe:[29804]
lrwx------ 1 neo4j nogroup 64 Jun  2 09:30 114 -> anon_inode:[eventpoll]
lrwx------ 1 neo4j nogroup 64 Jun  2 09:30 115 -> socket:[29805]

What Others Think

Read the man pages please. lsof -c neo4j is just doing this
jld · 265 weeks and 1 day ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: