Running Homebrew Commands with sudo on Linux and macOS

Sometimes a command installed with Homebrew needs to be executed as root. A good example is nethogs, which needs elevated privileges to inspect network traffic. The problem is that this often fails: [crayon-6a81bf09e1140090974285/] even though this works: [crayon-6a81bf09e1145224580723/] The reason is that sudo usually runs with a different, restricted PATH. Your normal shell can find [ ]