Q. How do I install the free, open-source, Unix administrative tool called lsof (for LiSt Open Files) under FreeBSD operating system to displays information about files open to Unix processes?
A. lsof lists information about files opened by processes
for the varios UNIX dialects. An open file may be a regular file, a directory, a block special file, a character special file, an executing text reference, a library, a stream or a network file (Internet socket, NFS file or UNIX domain socket.) A specific file or all the files in a file system may be selected by path.
FreeBSD install lsof package
Type the following command to update current ports collection and install lsof from ports:
# portsnap fetch update
# cd /usr/ports/sysutils/lsof
# make install clean
Now you can use lsof commad, enter:
# lsof -i -U
# lsof -i 4 -a -p 2053
# lsof -i 6
$ man lsof