Re:A Unix Utility You Should Know About: Pipe Viewer
by gcv on Monday February 02, 2009 @10:52AM
(#462411)
Looks like the Esc-. trick works in zsh as well. I didn't know about it. Cool. Thank you.
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.
Re:A Unix Utility You Should Know About: Pipe Viewer
by nuclear_eclipse on Monday February 02, 2009 @12:24PM
(#462547)
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...
Re:A Unix Utility You Should Know About: Pipe Viewer
by likpok on Monday February 02, 2009 @11:15AM
(#462452)
I doubt it. One of the big features of zsh over bash is the tab completion is fantastic (arguments, URLS, etc). With a good .zsh and .zshrc, it is an amazing experience.
Re:A Unix Utility You Should Know About: Pipe Viewer
by nuclear_eclipse on Monday February 02, 2009 @12:36PM
(#462564)
My only complaint with Zsh's tab completion, which is usually far superb compared to Bash, is that package-name completion is much slower in Zsh as compared to Bash, at least on the Debian and Ubuntu systems that I use. Typing `aptitude install build-<Tab>` in Bash almost immediately completes "build-essential", but Zsh can take anywhere from 3-15 seconds to search through the package cache before completing the same package name.
Other than that, I absolutely love Zsh's completion system, and the awesome capabilities it provides, like context-sensitive Git argument completion, such as `git add <Tab>` listing only the files that are either changed since the last commit, or not yet tracked by Git. Insanely useful!
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.:
'tree' is nice to picture a directory hierarchy.