zlacker

[parent] [thread] 9 comments
1. thayne+(OP)[view] [source] 2026-02-05 05:49:11
Or

    echo $NUM_PAGES | sudo tee /proc/sys/vm/nr_hugepages 

I've always found it odd that there isn't a standard command to write stdin to a file that doesn't also write it to stdout. Or that tee doesn't have an option to supress writing to stdout.
replies(4): >>axioli+61 >>TheDon+tr >>vbezhe+ga1 >>wang_l+FW1
2. axioli+61[view] [source] 2026-02-05 06:00:00
>>thayne+(OP)
You forgot the "sudo" before "tee"

> write stdin to a file that doesn't also write it to stdout

You mean like "dd of=/path/file" ?

replies(1): >>zdragn+9k1
3. TheDon+tr[view] [source] 2026-02-05 09:53:40
>>thayne+(OP)
> I've always found it odd that there isn't a standard command to write stdin to a file that doesn't also write it to stdout

If you happen to have moreutils installed, you can do that with pee

    echo $NUM_PAGES | sudo pee 'cat > /proc/sys/vm/nr_hugepages'
replies(1): >>direwo+bD
◧◩
4. direwo+bD[view] [source] [discussion] 2026-02-05 11:37:18
>>TheDon+tr
why not write sh -c then?
replies(1): >>TheDon+gJ
◧◩◪
5. TheDon+gJ[view] [source] [discussion] 2026-02-05 12:33:58
>>direwo+bD
Because 'sh' isn't in moreutils and is harder to remember, next question.

Why use something portable when you can use cat pee?

replies(1): >>semiqu+Sp1
6. vbezhe+ga1[view] [source] 2026-02-05 15:20:02
>>thayne+(OP)
I've always thought that there should be `cat -o output-file` flag for that. GNU coreutils have miriads of useless flags and missing one actually useful flag LoL.

And probably `echo -o output-file` as well.

◧◩
7. zdragn+9k1[view] [source] [discussion] 2026-02-05 16:13:36
>>axioli+61
I physically/literally squinted when I saw disk destroyer.

I know it's useful for other things, but it has become a fearful instinct at this point.

◧◩◪◨
8. semiqu+Sp1[view] [source] [discussion] 2026-02-05 16:45:11
>>TheDon+gJ
Personally? Because I hate the smell.
9. wang_l+FW1[view] [source] 2026-02-05 19:08:10
>>thayne+(OP)
It’s not an option or feature because it’s built into the shell. Just slap a > /dev/null on the end.
replies(1): >>thayne+td2
◧◩
10. thayne+td2[view] [source] [discussion] 2026-02-05 20:21:55
>>wang_l+FW1
That works, but it feels wasteful to needlessly copy it, and it is verbose.
[go to top]