On 1/27/21 3:01 AM, L A Walsh wrote:

Except the problem, which I've run into before, is to
have such a command executable by 'root' and output by 'root', Have you ever tried to drop your file caches?
need to echo "3" to /proc/sys/vm/drop_caches.  Except if you are
a normal user, you need to elevate to root first, but what you
suggest won't work:

  echo "3" | sudo cat >/proc/sys/vm/dropcaches
-bash: /proc/sys/vm/drop_caches: Permission denied

Cat isn't writing the file -- bash is.


What is so difficult with

$ echo "3" | sudo sh -c "cat > proc/sys/vm/dropcache"

I don't get it...

regards,
chris



  I ended up using
dd at the time, but tq seems more efficient:

echo "3" |sudo tq /proc/sys/vm/dropcaches

(which does work).



Reply via email to