82,367 reputation
1090193
bio website
location European Union
age
visits member for 1 year, 11 months
seen 2 hours ago

1d
comment shell script for auto-touching files
Actually, while -execdir helps for rm, it doesn't help much for touch as touch will follow symlinks as well. Some have a -h. Best is to add a ! -type l otherwise.
1d
comment shell script for auto-touching files
-exec {} + is standard and portable. For once, it was the GNU implementation that didn't support it until recently. Using -print | xargs is almost as bad as using command substitution. Would touch /etc/shadow if someone creates a file called "/tmp/ /etc/shadow" as well.
1d
comment shell script for auto-touching files
In a world writeable dir like /tmp, find /tmp -execdir touch -c {} \; is safer (with find implementations that support it) (though a lot slower).
1d
revised to compare two fields in two different files
formatting.
1d
comment how to use dd to fill drive with 1's
@mikeserv, actually, using tee - - - does increase throughput significantly in my testing. That's going from 800MiB/s for tr (950MiB/s with stdbuf) to 2.3GiB/s with tee, like you say in any case way above the rate any current drive can sustain.
1d
comment how to use dd to fill drive with 1's
@mikeserv, I think the only way to increase performance from that is to reduce the number of system calls made. tee won't help for that. stdbuf -o1M tr... may help.
2d
revised how to use dd to fill drive with 1's
added 14 characters in body
2d
comment Why are rmdir and unlink two separate system calls?
@Gilles, no, chroot() doesn't do a chdir(), so if your current directory was outside the jail before the chroot(), it still is after. That's why the literature always says to close your references to things outside the jail when doing chroot, otherwise you can escape the jail. (see man 2 chroot on Linux for instance, and you can try it for yourself)
2d
answered Nexenta bash script uses /usr/sun/bin/sed instead of /usr/bin/sed
2d
comment How could i flip content of a binary file with bash commands
@G-Man, more like "$(printf '\\%o' {255..0})" with zsh/bash/ksh93. Though, since it's always the same, there's no good reason you'd want to generate it every time.
2d
answered how to use dd to fill drive with 1's
2d
comment How could i flip content of a binary file with bash commands
What's a bash command?
2d
answered How could i flip content of a binary file with bash commands
2d
awarded  Enlightened
2d
awarded  Nice Answer
2d
revised Nexenta bash script uses /usr/sun/bin/sed instead of /usr/bin/sed
formatting
2d
comment Get text between a word and the last line?
Or <file tac | sed /word/q | tac for the last word to end of file (like yours, assuming word is to be found in the file).
2d
comment Get text between a word and the last line?
The first one can also be written awk /word/,0 file
2d
comment Why are rmdir and unlink two separate system calls?
Alright, that's rmdir / that returns EBUSY, removing it by another relative path (other than . and ..) is OK (though that means your current directory must be outside the chroot jail which is generally not the case when chroot is used).
2d
comment Why are rmdir and unlink two separate system calls?
I'm not sure what they mean by or is the root directory of the calling process. mkdir test; sudo strace -e chroot,rmdir perl -e 'chroot("test"); rmdir("test")' shows both chroot and rmdir succeed.