[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Clearing RAM Caches



On Mon, Aug 15, 2022 at 11:13:07AM +0300, Anssi Saari wrote:
> Timothy M Butterworth <timothy.m.butterworth@gmail.com> writes:
> 
> > When I run `sudo echo 1 > /proc/sys/vm/drop_caches` I receive the following error: bash: /proc/sys/vm/drop_caches: Permission denied
> 
> Unfortunately, it's your current shell and not root who does the
> redirection in this case so no permissions.
> 
> For a longer explanation see
> https://www.reddit.com/r/linux4noobs/comments/qq76qo/sudo_echo_vs_echo_from_the_root_shell/
> 
> A proposed alternative from there is to use tee, like this:
> 
> echo 1 | sudo tee /proc/sys/vm/drop_caches

To add another one, I like dd for that one (it doesn't clutter
stdout unnecessarily).

  echo 1 | sudo dd of=/proc/sys/and-so-on

Embarrasment of riches!

Basically, what one is looking for is a cat one can pass an
output file name as a command line argument -- or put another
way, a cat which opens its output itself.

Cheers
-- 
t

Attachment: signature.asc
Description: PGP signature


Reply to: