How to redirect the output of fuser to a file?

325 Views Asked by At

I'm using fuser with options -uv and I'm getting following output:

$fuser -uv ~/sh/test_script.sh

                     USER        PID ACCESS COMMAND
/home/abc/sh/test_script.sh:
                     abc        3501 f.... (abc)test_script.sh

However, when I try to redirect the output of the command I'm only getting PID in the file:

$fuser -vu ~/sh/test_script.sh >> t2.txt

                     USER        PID ACCESS COMMAND
/home/abc/sh/test_script.sh:
                     abc       f.... (abc)test_script.sh

$cat t2.txt
3501

Why is it not including all the information during output redirection?

Also, how to include all the information during output redirection?

Using lsof I'm able to redirect all the information to a file.

0

There are 0 best solutions below