Sunday, July 10, 2022

[SOLVED] Use of watch and lsof + grep together

Issue

When i use

lsof -p 3536693 | grep snapshot

I get an output

but if i try to

watch lsof -p 3536693 | grep snapshot

I get nothing. Aren't they compatible?

It works if I ommit grep, like

watch lsof -p 3536693

Solution

It works when the "watched" command is quoted, so:

watch "lsof -p 3536693 | grep snapshot"


Answered By - CrazyRabbit
Answer Checked By - Cary Denson (WPSolving Admin)