Live data from Hacker News

Top Unix Command Line Utilities

blog.coldflake.com

21–30 of 65 posts

Re: Top Unix Command Line Utilities

#22
post #3

These obviously aren't related to 2012 at all. Some issues: - don't forget that /dev/random blocks - It's easier to use dd_rescue to track progress than to signal dd - Using dd to zero out a hard drive repeatedly doesn't increase security[1]. Using ATA secure erase does[2] - an alternative for summing file sizes is du -ch **/*.png [1] http://en.wikipedia.org/wiki/Data_erasure#Number_of_overwrit... [2] https://ata.wik…

I think the only "secure" way to erase the contents of a hard drive is to repeatedly overwrite the disk surface with a mix of random/patterened data (like Darik's Boot & Nuke does). Also, for those wondering about the blocking of /dev/random , it will restrict the number of bits you can copy using dd , but this won't be apparent unless you attempt to copy more bits from the entropy pools than there are available for…

The ATA secure erase command is faster, and should be better than overwriting. Overwriting has potential for missing sectors marked as bad but Secure erase will get those.

Multiple over writes is pointless. There's the Gutmann stuff, but that's ancient and the 35 passes was for multiple drive controllers, if you didn't know what drive controller was being used.

But then sometimes you don't have to do what works, but what other people tell you. Thus, if you're working to a standard it doesn't matter if DOD specifications are actually more secure than a single secure erase, you do what the spec calls for. And if you have to persuade other people that the data is provably gone it's easiest to just grind the drives.

Re: Top Unix Command Line Utilities

#23
post #11
post #10

Where's the love for awk? It has been tucked away in a sub item but doesn't deserve first class status?

That whole "find -ls | awk" is wicked slow anyway; try wc and xargs... $ time find -ls | awk '{s += $7} END {print s}' 15970582120 real 0m27.721s user 0m1.256s sys 0m1.780s $ time find | xargs wc -c 2> /dev/null | tail -1 604260969 total real 0m0.332s user 0m0.068s sys 0m0.204s

The standard disclaimer on find | xargs: you should use -print0 and -0 to avoid problems with files with whitespace in their names, i.e.

   $ find -print0 | xargs -0 wc -c 2> /dev/null | tail -1
(Also, many uses of find | xargs can be replaced with -exec cmd {} \; or -exec cmd {} +, e.g.

  $ find -exec wc -c {} + 2> /dev/null | tail -1
although this isn't much faster in this case.)

Re: Top Unix Command Line Utilities

#24
post #14

I'm a heavy command line user (I don't have a graphical file explorer/manager for instance). Here is my top 42, in order of usage: ls, cd, git, ssh, make, e, cat, veille, rm, wpa_supplicant, grep, evince, mv, x, dhclient, cp, echo, todo, mplayer, scp, man, mkdir, ack, pdflatex, apt-get, apt-cache, sed, less, feh, racket, gcc, wget, xrandr, bg, svn, pmount, for, gpg, halt, ping, tail, top. "e" is an alias for emacscli…

wow...that's quite some statistical data you gathered! I tried this myself using this command:

    cat ~/.bash_history | cut -f1 -d' ' | sort | uniq -c | sort -n -r
turns out my .bash_history is clipped at it's default size-limit (500 lines). So I'll change that to gather more data for next year. My results started with: 147 clang++ 77 ls 54 cd 15 gs 14 rake 13 vim ...

where gs is short for "git status" ...and thanks for the hint about the substitution! I updated it on my page.

Re: Top Unix Command Line Utilities

#25
post #16

cat ~/.bash_history | cut -f1 -d' ' | sort | uniq -c | sort -rn | head -10 | cut -b9-

That's not enough, you need to split lines on "|" and ';' and before that after for's "do" and if's "then".

It's not too hard to do (a very basic) implementation of splitting on | and ;, e.g.

  sed 's/ *| */\n/g' ~/.bash_history | cut -f1 -d' ' | ...
(This fails on something like "echo 'a | b'" and doesn't split correctly on |& and || and doesn't split at all on &&.)

Re: Top Unix Command Line Utilities

#26
post #11
post #10

Where's the love for awk? It has been tucked away in a sub item but doesn't deserve first class status?

That whole "find -ls | awk" is wicked slow anyway; try wc and xargs... $ time find -ls | awk '{s += $7} END {print s}' 15970582120 real 0m27.721s user 0m1.256s sys 0m1.780s $ time find | xargs wc -c 2> /dev/null | tail -1 604260969 total real 0m0.332s user 0m0.068s sys 0m0.204s

I am not familiar with awk, what's the 's+= $7'? What is the argument 2 passed to wc? Why is the produced output different? What am I missing here?

Re: Top Unix Command Line Utilities

#27
post #11
post #10

Where's the love for awk? It has been tucked away in a sub item but doesn't deserve first class status?

That whole "find -ls | awk" is wicked slow anyway; try wc and xargs... $ time find -ls | awk '{s += $7} END {print s}' 15970582120 real 0m27.721s user 0m1.256s sys 0m1.780s $ time find | xargs wc -c 2> /dev/null | tail -1 604260969 total real 0m0.332s user 0m0.068s sys 0m0.204s

You sure that's not because of memory swapping? Once warmed up the awk command is much faster for me.

Also, the results are different - though I'm too lazy to figure out why right now :)

Re: Top Unix Command Line Utilities

#30
post #26
post #11

Earlier quoted context omitted.

That whole "find -ls | awk" is wicked slow anyway; try wc and xargs... $ time find -ls | awk '{s += $7} END {print s}' 15970582120 real 0m27.721s user 0m1.256s sys 0m1.780s $ time find | xargs wc -c 2> /dev/null | tail -1 604260969 total real 0m0.332s user 0m0.068s sys 0m0.204s

I am not familiar with awk, what's the 's+= $7'? What is the argument 2 passed to wc? Why is the produced output different? What am I missing here?

s += $7 means "add the content of the 7th column to the total"
Post reply on HN