Live data from Hacker News

How zsh is more useful than bash

slideshare.net

131–140 of 151 posts

Re: How zsh is more useful than bash

#131
My favorite feature that wasn't mentioned is completions for `kill`. For example, in bash I would have to `ps -ef | grep command_I_ran` then `kill -9 process_id_of_command_I_ran`. Bonus points if you can do that in one command! In zsh, you only need to do `kill -9 partial_command_i_ran[tab]` and it will complete it for you. Also, !$[tab] and the like. Also, you can set the theme to random to get a surprise every new window.

Re: How zsh is more useful than bash

#132
post #62

WTF? I wrote this slide deck. It was a presentation I made for a monthly "tech lunch" my team has. I made it after a couple of weeks of messing with zsh. It was for an audience of 4 other people who knew less about zsh than me. I can't believe someone posted it to HN! That explains the "this slide deck is getting traffic" email I got from Slideshare this morning.

You wrote a powerpoint for a four-person lunch?

Re: How zsh is more useful than bash

#133

Earlier quoted context omitted.

It does fix typos for me too, but most of the time asks weird things like, I typed 'aptitude' did I mean '.aptitude'? It loves misinterpreting some of my commands as dotfiles. Huh? Then again I have a knack for unintentionally breaking computers, so maybe I've done something in env or rc that's messed it up...

Using the following got rid of a lot of my correction woes: alias sudo="nocorrect sudo" That is why you were getting the .aptitude one, you can use it for other commands that it gets the corrections wrong often. I've since moved to vanilla bash+bash completion since it is everywhere and zsh completion seemed to annoy me more than help me.

Awesome, thank you!

Re: How zsh is more useful than bash

#134
post #56

Does zsh have bash's ESC+.?

Yes. Not only that but it has something even cooler: ESC + Q Let's say you are about to finish a really long command and realize you should have done one other command first. ESC + Q clears the current line, lets you enter a command, and then inserts the cleared line again on the next prompt. You have to try it to realize how cool it is.

I use Alt+# in bash to do something similar. It comments out the current line and gives you a new prompt. Then you can run whatever you wanted to do first, and then scroll up, delete the hash sign and hit Enter.

Esc-Q sounds easier, though.

Re: How zsh is more useful than bash

#135
post #61

My personal favorite zsh specific feature is the REPORTTIME environment variable. When set to a nonzero number it'll automatically print a summary after a long running command. My own http://imgur.com/6LCS1cj

This is super cool... been using zsh for a while and wasn't aware!

Re: How zsh is more useful than bash

#136
post #50

I see your zsh and I raise you fish: http://ridiculousfish.com/shell/ Try it. It's better.

I tried fish for a while, and it's really great. The out of the box experience is way better than zsh and bash. But I switched to zsh, mostly because I couldn't get used to the different syntax.

I just tried fish, way too slow. I held down the backspace key, and instead of deleting 10 characters, the entire line was gone. zsh is also too slow. bash may not have the bells and whistles, but it's at least super fast and doesn't get in your way.

Re: How zsh is more useful than bash

#137

Path replacement is also possible in bash, as in: cd site1 site2 if you just add this line to your ~/.bashrc: function cd() { if [ $# -eq 2 ]; then builtin cd ${PWD/$1/$2}; else builtin cd $1; fi }

A cleaner version: ^site1^site2

This will only work if cd is your last command, whereas the zsh version always works.

Re: How zsh is more useful than bash

#138

My favorite feature that wasn't mentioned is completions for `kill`. For example, in bash I would have to `ps -ef | grep command_I_ran` then `kill -9 process_id_of_command_I_ran`. Bonus points if you can do that in one command! In zsh, you only need to do `kill -9 partial_command_i_ran[tab]` and it will complete it for you. Also, !$[tab] and the like. Also, you can set the theme to random to get a surprise every new…

Just use pkill.

Re: How zsh is more useful than bash

#139
post #86
post #71

I switched back from zsh to bash, and I miss it terribly. Problem is, I need to run both virtualenv and rbenv, and they're both designed for bash, and don't work properly with my zsh for some reason.

I don't know what those are, but why not start them with a bash script, that you launch from zsh?

They're designed to mess around with your shell variables and environment to virtualize an environment for ruby or python. Unfortunately, they're not totally compatible with my customized zsh setup, and I don't have the time to rebuild and test a zshrc from scratch. Launching bash with them would be moot since I'd just have to spend my time in bash anyways, then.

Re: How zsh is more useful than bash

#140
post #110

Earlier quoted context omitted.

I just checked and fish is way slower at 'ls *' than zsh. (zsh was done 2x as fast even with a directory with more than 3x as much stuff in it) I have also a few other flags set in my zsh aliases that's not in fish. (Tested with 2.0b2)

fish passes the -G flag to 'ls' by default, which produces colorized output, but stats each file. So fish is actually outputting more information than zsh, and what your test is really measuring is the speed of '/bin/ls' vs '/bin/ls -G' To compare ls speeds for the same workload, run it directly: /bin/ls. I expect no difference, because it is the same binary. If you wish to compare globbing speeds, do not use bare ls…

I have ls aliased to 'ls -F -H --color=yes --group-directories-first', so no.

('/bin/ls *' is just as fast with '--color=yes' for me btw)

Post reply on HN