Bash Chain of commands and operations transfer root cmd output to user file

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

Often one want to show the result of a command executed by root to other users. The tee command allows easily to write a file with user perms from a command running as root:

su -c ifconfig | tee ~/results-of-ifconfig.txt

Only ifconfig runs as root.



Got any Bash Question?