The Archives

  • 04.26.09
    Command line Russian roulette fun | rafacas | (1)
    $ [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo Click Please notice that this is a fun command before copying and pasting. Via | xeoncross tweet.
  • 02.10.09
    Some xargs scripts, shell | pfortuny | (1)
    Rafacas has already mentioned it, but xargs is sometimes much more useful than what it looks like. Two examples come to mind: Way too many files for rm or ls. It may well happen that a script has generated more than 10000 files in the same directory (it was your friend, not you, I know). If you try and rm * in there, you will be in trouble. Ditto if you simply want to count them with ls | wc -l. However, the following works: $ find . -type f -print0 | xargs -0 ls | wc -l (or rm instead of ...
  • 10.15.08
    Safe remove cmd | rafacas | (0)
    rm -P file.txt Overwrite regular files before deleting them. Files are overwritten three times, first with byte pattern 0xff, then 0x00, and last with 0xff, before they are deleted.