4 ms·
> sudo echo $NUM_PAGES > /proc/sys/vm/nr_hugepages This won't work :) echo will run as root but the redirection is still running as the unprivileged user. Need
by kayson 8mo ago
> sudo echo $NUM_PAGES > /proc/sys/vm/nr_hugepages
This won't work :) echo will run as root but the redirection is still running as the unprivileged user. Needs to be run from a privileged shell or by doing something like sudo sh -c "echo $NUM_PAGES > /proc/sys/vm/nr_hugepages"
The point gets across, though, technicality notwithstanding.
- thayne 8mo agoOr 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.
- axiolite 8mo agoYou 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" ?
- zdragnar 8mo agoI 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.
- goestin 8mo agoIf my memories serves me right it was meant to be "Copy Convert" but "cc" was already taken for "C Compiler" so they went to the next letter in the alphabet (alpha beta), hence "dd". Thanks for listening to my TED talk of useless and probably false information :) edit: i will be stealing disk destroyer, though
- axiolite 8mo agoAccording to Dennis Ritchie, the name is an allusion to the DD statement found in IBM's Job Control Language (JCL), where DD is short for data definition https://en.wikipedia.org/wiki/Dd_%28Unix%29#History
- TheDong 8mo ago> 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'
- direwolf20 8mo agowhy not write sh -c then?
- TheDong 8mo agoBecause 'sh' isn't in moreutils and is harder to remember, next question. Why use something portable when you can use cat pee?
- semiquaver 8mo agoPersonally? Because I hate the smell.
- vbezhenar 8mo agoI'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.
- wang_li 8mo agoIt’s not an option or feature because it’s built into the shell. Just slap a > /dev/null on the end.
- thayne 8mo agoThat works, but it feels wasteful to needlessly copy it, and it is verbose.
- timetoogo 8mo agoGreat point, I was running as root so I didn't pick this up. Corrected, thank you!