201 points · by pkrumins · 17y ago · 63 comments
If my understanding is correct OSX uses the freebsd utilities so that would be your reason.
Metaphors are sometimes confusing. Call it what it is. "Reflection" should have been called "type information", for example, and "--forest" should have been called "--nested".
Reflection is the ability of something to introspect. The term "self-reflection" dates back to 1652[1], so why change it? "Type information" is inaccurate because reflection can mean more than just getting information about types, like interfacing with the runtime or getting information about the language implementation.
I don't think concepts should be misnamed at the expense of accuracy.
[1] http://www.merriam-webster.com/dictionary/self-reflection
I'm saying it shouldn't have been used in the first place. It's an awkward, confusing metaphor. Programs aren't "reflecting", because "self-reflection" is something that only a sentient creature can perform. Programs currently have no concept of "self". I'd say "reflection" is less accurate than "type information", which covers at least 95% of use cases, if not more.
I don't think concepts should be misnamed at the expense of accuracy.
Neither do I. Also, all else being equal, less metaphors are better.
As in:
ps axf
the command 'tee': let's you see what is happening at an intermediate stage of a pipeline (I originally thought your blog post would be about tee)
the -S flag to objdump: If you're trying to learn how compilers work or assembly, the '-S' flag to objdumb is absolutely beautiful. If you compile a binary with debugging symbols (-g in gcc), 'objdump -S binary' will intersperse the assembly with the original code, letting you see what each line compiled into.
I use 'pushd' and 'popd' bash builtins. It lets you remember current directories and have a stack of locations that you've been. Very valuable when you're jumping around a large source tree.
Even though not a command, I usually follow ls by "-ltr". That arranges it such that the most recently modified file is on the bottom. Very easy to see what files were modified.
"du -sk * | sort -rn" for a nice listing of directory sizes.
Pressing "esc, ." (That's the Esc key, followed by a period. Not together) in bash would insert the previous command's argument. i.e.:
bash# ls /some/really/long/path/to/a/huge/file.c
bash# vi [esc, .] # <-- that would insert the path
bash# vi $_ # <-- same effect
'tree' is nice to picture a directory hierarchy.With regard to pushd and popd: these tricks work in zsh also. In addition, (again, zsh-specific) you can set these options:
setopt auto_pushd # automatic directory stack
setopt pushd_minus # swap +/- for pushd and popd
setopt pushd_silent # no output after pushd and popd
setopt pushd_to_home # pushd with no arguments goes to ~
setopt pushd_ignore_dups # no duplicates in directory stack
With these options set, every time you change directories using cd, the directory goes into your directory stack, basically executing an implicit pushd. Then, move around the directory structure a little, and try typing 'cd -<Tab>' (meaning type 'cd -' and press Tab for autocompletion). It'll list entries in your directory stack by number (so -1 is your previous directory, -2 is the one before, and so on). It's a handy wrapper for bare pushd/popd functionality.Bash might offer similar functionality, but I don't know much about bash.
setopt pushd_to_home # pushd with no arguments goes to ~
I would personally dislike that, because without that option set, calling pushd (at least in Zsh) with no argument will actually rotate the top two elements on the directory stack, which can be extremely handy for switching between two places, rather than needing to constantly call `pushd +1` or `pushd -1`.e.g.:
$ pu ~
/home/user
$ pu workspace/project
/home/user/workspace/project /home/user
$ pu /tmp/data
/tmp/data /home/user/workspace/project /home/user
$ pu
/home/user/workspace/project /tmp/data /home/user
$ po
/tmp/data /home/user
$ po
/home/user
note that I alias pu="pushd" and po="popd" for easier shell usage... mmv "*.mp3" "old_#1.mp3"
prefixes all files in the current directory ending with .mp3 with 'old_'. Btw., the quotes around the arguments are necesssary because mmv uses some of the same metacharacters as the shell does.Multiple substitutions are allowed, e.g.:
$ mmv "*.*" "#1___#2"
renames blub.xyz to blub___xyz.zmv '(??)-(*).mp3' '$1 - ${(C)2:gs/_/ }.mp3'
Which would change "01-foo_bar_baz.mp3" into "01 - Foo Bar Baz.mp3"
qmv, qcp - Rename or copy files quickly, editing the file names in a text editor
Found nothing better for bulk renames because you get to use all the pattern/replace power of your favorite editor instead of learning some wierd specialized grammar through trial & error.
This is how to remove all spaces from mp3 filenames using vim:
qmv -f do *.mp3
:%s/ /_/g
:wq
http://www.joel.lopes-da-silva.com/articles/computer-science...
(including man pages etc.) Caveat: I didn't try it myself (I don't have Leopard).
echo -n 'GET / HTTP/1.0\r\n\r\n' | nc news.ycombinator.com 80
Of course there are more specific tools for specific protocols, like curl or wget for http, but nc is the swiss army knife. host1 (receiving): nc -l 6123 > tar xfz -
host2 (sending ): tar cfz - directory/ | nc host2 6123 alias gr 'find . -name \*.rb -o -name \*.rhtml -o -name \*.erb -o -name \*.rjs | xargs egrep \!*'
(backticks can be used similarly, but can run into command line length limits)tail -1000 logfile | cut -d ' ' -f 1 | sort | uniq -c | sort -n
Bots should stand out in the last couple of lines and have a linecount that is substantially higher than a normal user.
alias eta='pv'There is none in Linux - you end up having to find regexs to match data rather than simply piping to where and asking for the field you want.