Live data from Hacker News

Top Unix Command Line Utilities

blog.coldflake.com

41–50 of 65 posts

Re: Top Unix Command Line Utilities

#41
post #27
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

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 :)

You need to filter out directory entries.

    find -type f -ls|awk '{s += $7} END {print s}'
    find -type f -print0 | xargs -0 wc -c | tail -1
    find -type f -exec wc -c {} + | tail -1

Re: Top Unix Command Line Utilities

#43
Does anybody know of great guides to master the majority of the useful CLI tools available on Unix and Linux? For me the challenge is that I don't even know I have some of these fantastic solutions readily available. I'd really benefit of knowing they're there in the first place instead of hacking a homebrew solution every time.

Learn Linux the Hard Way talks about them quite a bit, is that the go to guide in 2012 or can I do better?

Re: Top Unix Command Line Utilities

#44
post #19
post #17

Earlier quoted context omitted.

I wonder how large is your HISTFILESIZE, to get these accurate statistics?

My .bash_history weights 1.7Mo (almost 100k lines). I set a very high HISTSIZE since I don't see any reason to lose this data.

One reason might be that bash reads this whole file into memory on interactive startup and rewrites it completely when shutting down.

Re: Top Unix Command Line Utilities

#46
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…

[deleted]

Re: Top Unix Command Line Utilities

#47
post #38
post #36

Earlier quoted context omitted.

The for loop works fine. Performing word splitting/wildcard expansion/etc on a variable will, well, split it into words/expand wildcards/etc, whether it was introduced by a for loop or not.

I am not sure I understand what you mean. Word-splitting is performed by the "for x in y" construct, using the IFS variable, so by default if you have a file called "foo bar.mp4" the command line from the article: for i in *.mp4; do ffmpeg -i "$i" "${i%.mp4}.mp3"; done will result in executing: ffmpeg -i foo foo.mp3 ffmpeg -i bar.mp4 bar.mp3 Which is obviously not what was meant. So it's a good habit to learn to loop…

Perhaps you have a very broken shell.

  $ function echon { echo $# $*; }                    
  $ >'foo bar.mp4'
  $ for i in *.mp4; do echon "$i" "${i%mp4}mp3"; done 
  2 foo bar.mp4 foo bar.mp3

Re: Top Unix Command Line Utilities

#50
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…

In a bash session (bash 2.05 or later):

  $ hash | sort -nr | less
shows usage counts and full paths of executed commands.
Post reply on HN