The second #6 example, the one with xargs, is wrong. Xargs(1) doesn't necessarily create a single du process, it might create several.
I was wondering about that, but is it really wrong? From what I found in the "BSD General Commands Manual": Any arguments specified on the command line are given to utility upon each invocation, followed by some number of the arguments read from the standard input of xargs. The utility is repeatedly executed until standard input is exhausted. and -P maxprocs Parallel mode: run at most maxprocs invocations of utility…
Top Unix Command Line Utilities
61–65 of 65 posts
Re: Top Unix Command Line Utilities
#62Earlier quoted context omitted.
One reason might be that bash reads this whole file into memory on interactive startup and rewrites it completely when shutting down.
I second this, I think it is good practice to rotate the history file manually when it reaches several MBs. (Using zsh, the main symptoms of a large history file is sluggishness when using ^R and a lag of a few tenths of a second when closing a terminal.)
Re: Top Unix Command Line Utilities
#63Where's the love for awk? It has been tucked away in a sub item but doesn't deserve first class status?
actually there is heaps of love for awk... so much actually that I'd rather spend a whole post on it than to "just" make it one item :)
Re: Top Unix Command Line Utilities
#64The second #6 example, the one with xargs, is wrong. Xargs(1) doesn't necessarily create a single du process, it might create several.
I was wondering about that, but is it really wrong? From what I found in the "BSD General Commands Manual": Any arguments specified on the command line are given to utility upon each invocation, followed by some number of the arguments read from the standard input of xargs. The utility is repeatedly executed until standard input is exhausted. and -P maxprocs Parallel mode: run at most maxprocs invocations of utility…
Re: Top Unix Command Line Utilities
#65My 2012 top, in order of usage: joe, ls, cd, time, cdbdump, tail, more, cat, rm, grep, wc, apachectl restart, find, curl, chmod, history, mv, locate, cpan, apt-get, pwd But the most useful one is a command line Perl utility I called "flt" that executes a block of perl code for each in the stdin. cat file.txt | flt ' $line=~ s|\s+| |gsi; print $line."\n"; ' That would compact free spaces find . | flt ' if (-f $line) {…
Are you familiar with perl's -n and -p switches? http://perldoc.perl.org/perlrun.html#*-n* Those "flt" lines could be written perl -lpe 's|\s+| |gsi' file.txt find . | perl -ne 'if (-f) { print -s }' (-l chomps the incoming newlines, and puts them back on the output) Of course, "perl -ne" is longer than "flt", and I appreciate all this implicit use of $_ is not to everyone's tastes.