1,480 reputation
623
bio website localhost
location San Francisco, CA
age 39
visits member for 3 years, 3 months
seen yesterday

Research Computing Architect at the University of California, Berkeley


Feb
26
comment How do I prevent accidental rm -rf /*?
Yes, I think that scoping out files using find is a good suggestion, however the nuances of xargs are important if you suggest using it, otherwise it leads to confusion and frustration when encountering files with spaces (which is avoided by using the -delete option).
Feb
26
comment How do I prevent accidental rm -rf /*?
It's good you're trying to preview your files before deleting them, however this solution is overly-complicated. You can instead accomplish this very simply in a more generic way using the find command. Also, I don't understand why you say "the good thing about it is that it's only Bash"? It is recommended to avoid bash-isms in scripts.
Feb
26
comment How do I prevent accidental rm -rf /*?
+1 for using some method of previewing your files before you delete them, however there are simpler and safer ways to do that using the find command.
Feb
26
comment How do I prevent accidental rm -rf /*?
@MadHatter Also, globbing, though visually somewhat similar, is very different semantically from regular expressions. In a regex the meaning of * has a very precise definition called the Kleene Star which is a unary operator that matches zero or more elements of the set to which it is applied (in the case of regular expressesions, the character or set of characters preceding the Kleene Star), whereas in globbing the * matches anything in the pattern that follows. They are semantically very different even if they seem to have a similar syntax.
Feb
26
comment How do I prevent accidental rm -rf /*?
@MadHatter Checking to see what files match before you delete them is good advice, but there is a safer and more expressive way to do it with the find command.
Feb
26
comment How do I prevent accidental rm -rf /*?
@Giles Not using rm directly is good advice! An even better alternative is to use the find command.
Feb
26
comment How do I prevent accidental rm -rf /*?
@eventi I agree that there is some terrible advice and ugly hacks in this thread. And it's definitely a good idea to look at something before destroying it, but there is an even better way to do that using the find command.
Feb
26
comment How do I prevent accidental rm -rf /*?
Previewing the files first before deleting them is a good idea, and there is an even safer and more expressive way to do it using the find as I explain in my answer.
Feb
26
comment How do I prevent accidental rm -rf /*?
It is good you suggest using find, but I recommend a safer way of using it in my answer. There is no need to use xargs rm since all modern versions of find have the -delete option. Also, to safely use xargs rm you also need to use find -print0 and xargs -0 rm otherwise you'll have problems when you encounter things like filenames with spaces.
Feb
26
answered How do I prevent accidental rm -rf /*?
Feb
20
comment Resetting SP password using jumper P20 doesn't work on Sun Fire x4600 M2
@WesleyDavid I figured a photo of the screen would help head off people asking questions about whether I had installed the jumper properly or not.
Feb
20
revised Resetting SP password using jumper P20 doesn't work on Sun Fire x4600 M2
added 85 characters in body
Feb
20
asked Resetting SP password using jumper P20 doesn't work on Sun Fire x4600 M2
Feb
19
revised How can I prevent a test virtual host on Apache from consuming too many resources relative to the main host?
added tag plesk
Feb
19
suggested approved edit on How can I prevent a test virtual host on Apache from consuming too many resources relative to the main host?
Feb
18
comment What's the best way of handling permissions for apache2's user www-data in /var/www?
@Tom Great to see that you recommend using the findcommand for this. One small performance tip I would give if you have lots of files/directories and you are using GNU find is to use + instead of \; so that the command will operate on multiple files because "it is faster to run a command on as many files as possible at a time, rather than once per file. Doing this saves on the time it takes to start up the command each time." Also, it is easier to type since it doesn't need backslash.
Feb
16
revised At what point is EBS usage the bottleneck?
added tags performance disk-performance
Feb
16
comment At what point is EBS usage the bottleneck?
@tsykoduk In general, all the AWS storage types have somewhat non-obvious performance and even though it might seem that RAID10 could improve performance it is really better to try benchmarking with the kind of access patterns and load that your real application is likely to experience. Even then your performance is likely to vary wildly at times in the AWS environment compared to a self-hosted solution where you have more control-- and thus more predictability-- over the storage performance. In general, have more than one volume in a RAID configuration is likely to have a positive impact.
Feb
16
revised At what point is EBS usage the bottleneck?
added 1411 characters in body
Feb
16
suggested approved edit on At what point is EBS usage the bottleneck?