7 ms·
- I'm using bash on Ubuntu. When I type "kill <tab>" I get a list of process numbers, not the list of files in my current directory as you imply. - shared his
by bryanlarsen 15y ago
- I'm using bash on Ubuntu. When I type "kill <tab>" I get a list of process numbers, not the list of files in my current directory as you imply.
- shared history sounds like a bug, not a feature. I have long lived terminals open, each dedicated to a specific purpose. Shared history would intermingle them.
- typing `gut` in bash gives me:
No command 'gut' found, did you mean:
Command 'cut' from package 'coreutils' (main)
Command 'get' from package 'code-aster-run' (universe)
Command 'gout' from package 'scotch' (universe)
Command 'git' from package 'git' (main)
Command 'gpt' from package 'gpt' (universe)
Command 'gst' from package 'gnu-smalltalk' (universe)
You're batting 0/3. Certainly there must be some advantages to ZSH, but you haven't listed any yet.
(Note that I didn't have to configure any of this. Ubuntu probably did, but I didn't).
- ohgodthecat 15y agoShared history can be either a burden or a godsend, I like it but I usually just end up using whatever basic bash shell I'm on without a custom config as most of the things I do are remote. The zsh autocorrect works much differently than what you have given. You have shown a feature of ubuntu (and probably debian) that looks for packages matching/close to your given command but what zsh does is give you, depending on your chosen settings, full autocorrect. Where you may be able to type gut status and get No command found the setup in zsh would allow either for gut status to be autocorrected to git status or would ask you if you meant git status while waiting for a confirmation.
- 0xABADC0DA 15y agoZsh has knobs for shared history. You can configure all terminals to have the same history at the same time, but I have it set to add history to the .zsh_history file immediately, but each shell gets it's own history. So ctrl-r in a shell lists commands entered into that shell (or preexisting when it started), and opening a new terminal starts with the shared history from all terminals. This is really the best of both worlds. Also there's a knob to only add a command if it isn't in the history, so no scrolling back over a dozen "cd .." or whatever. Zsh has floating point math, for instance $((1.0/2)) is 0.5 instead of an error. This comes in handy sometimes in simple scripts. Zsh is significantly faster. Zsh autocomplete is much more advanced. Bash may have copied the pid completion and some other easy ones, but zsh has all sorts of completion hooks, for instance "svn help ch<tab>" expands to "changelist". It also runs --help and parses out GNU style help text for completing options. Zsh completion also has optional Windows-style cycle mode, so you can do "prefix<tab><tab>"... and cycle through the matches instead of prefix<tab>a<tab><tab>b<tab>-<tab>" like in bash. I think you can actually make bash do this but it's some obscure key binding. ...basically zsh is just a bit better at everything. {edit: oops meant to reply to grandparent}
- sandGorgon 15y agowow - would you know the settings for the whole shared history thing you wrote about. I have mine set up in a less than ideal way and have never been able to google for these settings.
- 0xABADC0DA 15y agoThese are the history setopt's I have, but I don't know if they all make sense with each other though. I set it up once and haven't touched it in years. HIST_IGNORE_DUPS # don't add multiple 'cd ..', etc in a row? HIST_EXPIRE_DUPS_FIRST # save unique hist entries longer HIST_VERIFY # edit recalled history before running INC_APPEND_HISTORY # add commands to .history immediately EXTENDED_HISTORY # save timestamp on history entries # set a huge history... doesn't seem to affect performance at all HISTFILE=~/.zsh_history HISTSIZE=10000 SAVEHIST=$((HISTSIZE/2)) For the completion I setopt AUTO_REMOVE_SLASH GLOB_COMPLETE MENU_COMPLETE NO_AUTO_LIST NO_BAD_PATTERN NO_BEEP NO_LIST_AMBIGUOUS NO_LIST_BEEP NO_NOMATCH, but I'm not sure what they all do ;-P
- dedward 15y agoim pretty sure bash does shared history if you desire it, the configuration is just not as directly obvious. I prefer a long histfile (unlimited really, i. think i have it set to a million lines, but im at about 70 000. i even keep it backed up regularly because its fairly easy to trash the histfile if you are opening subshells and do the wrongthing. timestamped, too, which i find really handy. that said, i do use and like zsh on my primary workstation, love it.. but i dont bother priming every other remote box with it, my bash config is simple and tweaked up just rightfor remote servers, and bash is there by default (dealing with older systems, etc.....i know zsh is installed by default often too)
- xolox 15y agoSorry for being off-topic, but do you know how the ZSH history file gets trashed? It's happened so often to me that I wrote a script to reconstruct my history file by combining the last handful of backups. I still haven't figured out how the history file gets trashed though :-( Edit: Since I'm in ZSH company, here's the script: https://gist.github.com/1713414 https://gist.github.com/1713414
- pmr_ 15y agoHe also doesn't hit the mark on editing modes. Emacs and Vi keybindings for shells are usually provided by libreadline. I was really looking for a different shell before. But if those are zsh killler features, it certainly wont be my choice.
- mgrouchy 15y agoZsh use's zle(Z-Shell Line Editor), which is different then libreadline as its part of the shell not a separate library. Zle's behavior is editable through your .zshrc. Maybe I dumbed the post down too much, was just listing a few features that I use every day that IMO work better then the comparable Bash features.
- samwilliams 15y agoI read and enjoyed the article and I am surprised it has recieved this level of criticism here. Perhaps you should update it and add a number of the other features that you like about it (with a brief description..)? (edit: spelling)
- Symmetry 15y agoIn fairness to zsh, "kill <tab>" just lists the number rather than giving the names. In zsh or fish, by contrast, you get the process name too.
- sandGorgon 15y agoabout the 3'rd thing, that's not a bash thing - that's a ubuntu thing, which nicely integrates with bash by default. You could get the same thing by putting function command_not_found_handler() { /usr/bin/python /usr/lib/command-not-found -- $1 } in your .zshrc P.S.
- icebraining 15y agoYour third example is not the same. Does Bash correct it for you, or just lists similar commands?
- gcv 15y agoShared history in zsh is essential to my workflow. I also keep many terminals open, and while I do separate them by task, I often just pick one which happens to be in the right directory and start typing away. I always search through history using Ctrl-R, and almost never use up-arrow cycling. Shared history makes this work seamlessly. This is obviously configurable, so if you prefer a different workflow, zsh will accomodate it.
- masklinn 15y agoFwiw on #3, it's not the same at all. 1. Your feature comes from Ubuntu, not bash 2. More importantly, in ZSH if the correction is accepted by the user the command gets executed (with the fix) without any manual redoing. The correction can even be made permanent for frequent typos. (and while I like ZSH a lot, shared history does tend to be a pain in the ass for me)
- thenduks 15y agoHow about the fact that zsh enforces that you spend a certain amount of time per day just contemplating your existence: % time zsh -c exit zsh -c exit 0.22s user 0.21s system 97% cpu 0.436 total $ time bash -c exit bash -c exit 0.00s user 0.00s system 83% cpu 0.004 total Typing too early will just blackhole your keystrokes, of course, so no cheating! Or how about how when using an RPROMPT it makes copy/pasting stuff out of the terminal infuriate your IM buddies? :) Actually these are downsides, let's try fish instead, maybe? % brew install fish % fish zsh: correct 'fish' to 'vis' [nyae]? GRRR