Performance Tuning “lsof” command in Linux

Posted: September 6, 2013 in IOSTAT, Performance Tune

1. List all Open Files with lsof Command

 

Screenshot_27

Sections and it’s values are self-explanatory. However, we’ll review FD & TYPE columns more precisely.

FD – stands for File descriptor and may seen some of the values as:

  1. cwd current working directory
  2. rtd root directory
  3. txt program text (code and data)
  4. mem memory-mapped file

Also in FD column numbers like 1u is actual file descriptor and followed by u,r,w of it’s mode as:

  1. r for read access.
  2. w for write access.
  3. u for read and write access.

TYPE – of files and it’s identification.

  1. DIR – Directory
  2. REG – Regular file
  3. CHR – Character special file.
  4. FIFO – First In First Out

2. List User Specific Opened Files

 

Screenshot_28

 

3. Find Processes running on Specific Port

 

Screenshot_29

 

4. List Only IPv4 & IPv6 Open Files

 

Screenshot_30

 

Screenshot_31

 

5. List Open Files of TCP Port ranges 1-1024

 

Screenshot_32

 

6. Exclude User with ‘^’ Character

Screenshot_33

 

7. Find Out who’s Looking What Files and Commands?

 

Screenshot_34

 

8. List all Network Connections

 

Screenshot_35

 

9. Search by PID

Screenshot_36

10. List all TCP or UDP connections

Screenshot_37

 

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s