permission denied on a sudo command

Yet another newbie question :
Trying to configure my vr headset, I have to setup my gpu in vr mode. I installed corectrl but I can't figure how to lauch the app. Anyway, someone in a discord gave me a command to authorise apps to change the power profile. However when I run it I get this :
bazzite@bazzite:~$ sudo echo 4 > /sys/class/drm/card0/device/pp_power_profile_mode
bash: /sys/class/drm/card0/device/pp_power_profile_mode: Permission denied
Solution
you cant sudo echo to a file
you need to echo pipe into sudo tee
echo hello | sudo tee /sys/class/foo
Was this page helpful?