[Linux] Using lsof

lsof = List Of Opened Files. But I'm going to use procfs instead...

Here is how I watch what transmission-gtk client is currently downloading on my remote Linux box:

$ watch -n 1 "ls -l /proc/$(pidof transmission-gtk)/fd | grep Downloads"

...

Every 1.0s: ls -l /proc/17477/fd | grep Downloads                                              xxxxxx: Mon Feb 24 11:36:01 2020

lrwx------ 1 i i 64 Feb 24 11:35 24 -> /home/i/Downloads/SAP ECC v6.0 SR3 IDES Oracle 10.2.0.2/50096277_part3.rar.part
lrwx------ 1 i i 64 Feb 24 11:35 25 -> /home/i/Downloads/oracle_db12102/linux.zseries/linux.zseries64_12102_gsm.zip.part
lrwx------ 1 i i 64 Feb 24 11:35 28 -> /home/i/Downloads/oracle_db12102/Solaris-SPARC/solaris_sparc32_12102_client32.zip.part
lrwx------ 1 i i 64 Feb 24 11:35 29 -> /home/i/Downloads/SAP ECC v6.0 SR3 IDES Oracle 10.2.0.2/51037623_part16.rar.part
lrwx------ 1 i i 64 Feb 24 11:35 30 -> /home/i/Downloads/SAP ECC v6.0 SR3 IDES Oracle 10.2.0.2/50096277_part2.rar.part
lrwx------ 1 i i 64 Feb 24 11:35 32 -> /home/i/Downloads/SAP ECC v6.0 SR3 IDES Oracle 10.2.0.2/51037093_part3.rar.part
lrwx------ 1 i i 64 Feb 24 11:35 33 -> /home/i/Downloads/11.2.0.3/p10404530_112030_Linux-x86-64_3of7.zip.part

...

And since transmission torrent client marks unfinished files with ".part" suffix, you can see only unfinished files:

watch -n 1 "ls -l /proc/$(pidof transmission-gtk)/fd | grep Downloads | grep \.part"


List of my other blog posts.

Yes, I know about these lousy Disqus ads. Please use adblocker. I would consider to subscribe to 'pro' version of Disqus if the signal/noise ratio in comments would be good enough.