I want to redirect the result of 'lsof' to a file, but it does not work like this.
$ sudo ./lsof > result.txt
-bash: result.txt:
Is there anyone why it does not work?
Because may be you do not have permission to wrote to file. Try following:
sudo lsof | sudo tee results.text
Or
sudo -s
lsof | tee results.txt