9 ms·
Zsh 5.9
- azaras 4y agoIt is worth, as a long time Bash user, to change to ZSH?
- Tajnymag 4y agoSure. Some of its features are pretty handy and it is basically fully bash compatible. You don't really loose anything.
- rubyist5eva 4y agoI switched from Bash to ZSH with the caveat that I use prezto and powerlevel10k (included with prezto) and I will never go back. I had to turn off some of the Zsh-specific brackets and quoting features to make it more bash-like because of the tools I use which make it kinda wonky to use with Zsh but otherwise it’s been absolutely fantastic. Remoting into our systems that only have bash feels absolutely prehistoric. https://github.com/sorin-ionescu/prezto https://github.com/sorin-ionescu/prezto
- ideasman42 4y agoI switched to ZSH and was quite happy with it, now using FISH - mainly because of it's excellent auto-completion that displays as you type. Otherwise both ZSH and FISH are good options IMHO. Although for typical "shell-scripting" I still use BASH for the most-part where scripting languages like Python aren't as suitable, so my scripts can be used on other peoples systems.
- linsomniac 4y agoDitto. Had been using zsh for ~5 years as a better bash, but around 6 months ago tried some of the plugins for suggestions and history, but ended up switching to fish.
- nop_slide 4y agoDo you have some personal examples where Python wasn't suitable over bash for a non-trivial task? I am admittedly a not very good bash'er, and this week at work I whipped up my first "complicated" bash script, but ended up rewriting it in Python. It might have just been the case that the IO bound nature of my task fell right into Python's strong suits (async IO), but it had me wondering what scenarios a bash script would be better. Essentially I had to: * iterate over a list of hundreds of thousands of files * make an api call via aws cli * take result and process it through a few shell utilities (`date` and `touch`) to then update the timestamps on the files. I initially wrote it in bash which spawned ~16 background workers (threads/processes?) via `&` and blocking via `wait -n`. This "worked" but was pretty slow as the threads were thrashing checking for responses. Doing anything more than 16 caused my computer to crawl lol. I then rewrote it in Python with async IO and the async subprocess API (to run shell commands) and it was an order of magnitude faster. I wish I was better at bash, but maybe I just haven't spent enough time with it. Doing this task made me feel like I could pretty much doing most things in Python if I need a non-trivial script.
- DocTomoe 4y agoI think it's less about pure suitability, and more about availability. If I write a Bash script, I can be reasonably certain it will run on any unixoid system that came out in the last years. With Python, I am now in version hell (it's ridiculous how many Python2-first-servers I still find), I'll run the risk of includes suddenly becoming incompatible or buggy. Can Bash do everything that Python can? Almost certainly not. But it is available, it is relatively simple (and almost minimalistic), and it forces you to learn more about standard unix tools. Your specific use case ... well, I think that's pretty unusual - I'd wager if you had avoided the parallel processing and done it in a more linear way, you've had a better time.
- nop_slide 4y agoThat makes sense! I will admit it was a bit of fun clobbering together the bash version at first. It reminded me of starting out programming where everything felt a bit esoteric lol. > if you had avoided the parallel processing and done it in a more linear way, you've had a better time. I had to process ~500,000 files, and the aws api call was on average ~1 second, so it would have been a significantly longer time to process linearly. For example the bash version I whipped up processed ~30k files in 2.5 hours, while the python version did 30k files in ~20 minutes. But yes I agree, if I didn't have to do such a large volume at once the bash version would have been just fine.
- dizhn 4y agoI switched to fish and loved it. Then I realized there was no way to make the completion and matches case sensitive or non-fuzzy. On their github they say something like this would require the c word ("configuration") and they won't do it. So I moved to zsh, enabled two plugins and borrowed a config. I have 99 percent of what I like about fish. It's quite awesome. If anyone is looking to try out zsh, please please please don't start with oh-my-zsh. I actually went zsh-fish-zsh. My first zsh attempt being with oh-my-zsh.
- charlieflowers 4y agoI started with oh-my-zsh when i moved to mac for work. What am i missing?
- throw0101a 4y ago> FISH - mainly because of it's excellent auto-completion that displays as you type. Said functionality for zsh: * https://github.com/zsh-users/zsh-autosuggestions https://github.com/zsh-users/zsh-autosuggestions
- allarm 4y agoIn fish it’s built in, that’s the beauty.
- maratc 4y agobash is great for scripting and zsh can be made great for interactivity. I use zsh with prezto and history-substring on and auto-suggestions on, it's great.
- cassepipe 4y agoIf you like vim mode, the zle vim mode is more complete than readline's, it can handle test objects for example. That's a small thing but that's nice. Prompt config is also quicker/easier to remember. Small things do add up.
- cpach 4y agoI recommend Fish. Very nice shell. https://fishshell.com/ https://fishshell.com/
- orangepurple 4y agoI see no reason to continue using Zsh or Bash in a world where Fish shell exists.
- xvmt 4y agoThere are at least two, though they may not be relevant for everyone: POSIX compatibility and ubiquity on random systems where your ability to install things is limited.
- kergonath 4y agoWell, I like it and that’s a good reason for me.
- chillpenguin 4y agoSome things won't work out of the box if your shell isn't posix compliant. For example, I once installed Ocaml, and its installer assumed my shell was posix, so some of the commands broke (I forgot the exact details now). Also NVM (node version manager) doesn't work with fish (or at least at the time). Sometimes there are alternatives or workarounds, but the fact is that using fish does come with that downside. Doesn't come up often, but it is annoying when it does come up. I like fish btw, just saying that I disagree with your "no reason to continue using zsh" comment. I use zsh because I was fed up with random things breaking due to not having a posix shell. And zsh can be customized to have most of the niceties of fish anyway. But it is pretty cool how fish comes with so many niceties out of the box!
- sfink 4y agoPerhaps it's niche, but there's a single feature that makes me use zsh over bash: EXTENDED_GLOB, used together with * filename expansion. ls **/*.d gives me all files, recursively, that end in .d. That's available in bash too if you `shopt -s starglob`. But it also gives all directories, so if I do eg grep pattern **/*.d then I get lots of error messages about trying to grep on directories (if I happen to have directories ending in .d). With zsh, I can do grep pattern **/*.d(.) and it will restrict to just files. I use this pretty often, and it saves me from many `find | xargs` commands. I pretty much only use `find` when there are too many matches for a single command. My muscle memory types fgrep -l SOMESTRING **/*(.) multiple times per day. That'll list out all files containing the literal SOMESTRING anywhere in or below my current directory. I'm sure I could be using one of the fancy grep replacements, and I have in the past, but this works Good Enough and only requires zsh to be installed, so it's what I have held onto.
- planede 4y agoAt least GNU grep has `grep -r --include='*.d' <pattern>`
- soraminazuki 4y agoTab completion alone is a good reason to switch. bash completes only filenames most of the time even with a bunch of third party completion scripts. Meanwhile, zsh provides smarter completion as part of its default installation, which you can enable with this 3 line configuration: autoload -Uz compinit; compinit setopt menu_complete zstyle ':completion:*' menu select
- jacobsenscott 4y agoProbably not. I think they both have comparable features, and by default are pretty bare bones without a lot of extensions and configuration. If you do want to try something new I would suggest fish shell. It is like a fully tricked out bash or zsh, but out of box. It is also very fast, because those tricks are built directly into the shell. I used to use zsh and after adding all the bells and whistles it got very slow.
- enriquto 4y ago> It is worth, as a long time Bash user, to change to ZSH? It doesn't make a lot of a difference. For me the major selling point of zsh is that it has two forms of process subsitution: regular <(...) as in bash, based on sockets, and =(...), which creates temporary files. This allows you to do some neat things that are not possible or comfortable in bash.
- adrian_b 4y agoI have been using bash for decades, not only on Linux, but also on other UNIX-derived operating systems. Less than a year ago, I have tried zsh, without a definite intention to switch to it, but eventually I ended always using zsh for interactive use, while continuing to use bash for scripts. I have benchmarked some scripts with both zsh and bash, but I have not seen any significant difference in speed. While there are a few scripting features originally introduced by zsh (most of the brace expansion variants), bash has also incorporated them many years ago. Besides those, both bash and zsh implement the ksh93 features, so there is little reason to prefer one or the other. Therefore I have stuck to bash for scripts. It is hard to say exactly why now I prefer zsh for interactive use, because there is no killer feature, but mostly various small details. For some reason, zsh seems more responsive, when interactive. I rely a lot on autocompletion and the default autocompletion rules in zsh are more powerful and also the zsh autocompletion seems faster. While in most cases I prefer the way zsh handles autocompletion, there are times when zsh annoys me by trying to be too smart, e.g. it will never autocomplete "mkdir" with the name of an existing file. I need that frequently, when I want to create a subdirectory in which to move a bunch of related files, with very long names that I do not want to type, but I want to edit slightly to make a name for the new subdirectory, so I have to use a workaround like autocompleting a "ls", then editing it into a "mkdir", while that was not needed in bash. In zsh I use a much more complex shell prompt that I had used in bash, which displays a lot of useful information in a format that avoids confusion with the command lines or with the text output of the executed commands. After switching to it in zsh, I have discovered that such a complex shell prompt is also possible in bash. Nevertheless, after using it in bash I have discovered some bash bugs. The too complex shell prompt confused bash and the text cursor became desynchronized with the correct position in certain contexts, so I had to revert in bash to a simple shell prompt. I think that you should give zsh a try for interactive use. After using it for some days you will see if you prefer it to bash or not. Now I prefer the interactive zsh, but there are no large differences, bash and zsh are similar and mostly equivalent, because whenever one was improved somehow, the other also copied that feature soon. I had completely forgotten, but when I have tried for the first time to use zsh as a bash user, I have spent some ten minutes of great confusion, until discovering that I have to add to my ".zshrc" the lines: bindkey '^[[H' beginning-of-line bindkey '^[[F' end-of-line bindkey '^[[3~' delete-char-or-list in order to have the line editing keys with which I was accustomed.
- nerdponx 4y agoParameter expansions don't need to be defensively quoted. That's what got me to switch.
- ideasman42 4y agoAre there any interesting new features in this release?
- doctoboggan 4y agoI've been using ZSH ever since macOS moved to using it as the default shell. I honestly can't say I've noticed any differences. What are some features I should be using to get the most out of ZSH?
- jw1224 4y agoHave you seen https://ohmyz.sh/ https://ohmyz.sh/ ? It’s indispensable, can’t imagine zsh without it now…
- _joel 4y agoexactly this, I love it.
- fernandotakai 4y agoi prefer zpresto https://github.com/sorin-ionescu/prezto https://github.com/sorin-ionescu/prezto
- SemanticStrengh 4y agowhat makes you prefer it?
- konart 4y agoLook into https://ohmyz.sh/ https://ohmyz.sh/ or https://github.com/zdharma-continuum/zinit https://github.com/zdharma-continuum/zinit (or any other plugin managers) and some nice plugins.
- vbezhenar 4y agoI really like right prompt. My config is: PS1="%# " RPS1="%40<...<%~" This way I have current directory information without eating precious space. Other than that, I don't really use much zsh-specific functionality.
- codewiz 4y ago
- tiffanyh 4y agoI feel like I must be the only HN person who doesn’t really care what shell I use.
- capableweb 4y agoDo you spend most of your days reading from a shell/entering commands in a shell? That might make it more/less likely to care about the tooling you use. I spend a lot of time editing code, so naturally I care about what editor I use. Same with the shell.
- deleted 4y ago[deleted]
- bluejekyll 4y agoIt used to be that I’d end up on older systems with only cshell as the default. So immediately would install bash for what I had expected to be default behavior by that point. zsh never clicked for me though, until I used oh-my-zsh, which allows for sharing custom extensions from folks. And it’s great, and superior to bash. I used to not care, but these little improvements are worth it.
- yboris 4y ago+1 on oh-my-zsh I recommend Oh My Zsh with the zsh-autosuggestions [1] and zsh-syntax-highlighting [2] plugins. [1] https://github.com/zsh-users/zsh-autosuggestions https://github.com/zsh-users/zsh-autosuggestions [2] https://github.com/zsh-users/zsh-syntax-highlighting https://github.com/zsh-users/zsh-syntax-highlighting And my custom theme ;) https://github.com/whyboris/dotfiles/blob/main/yboris.zsh-theme https://github.com/whyboris/dotfiles/blob/main/yboris.zsh-th...
- xwowsersx 4y agohmm, I just added zsh-syntax-highlighting to my plugins and sourced .zshrc and got "[oh-my-zsh] plugin 'zsh-syntax-highlighting' not found" Any ideas?
- mprovost 4y agoI always assumed zsh was abandonware because it's still hosted on Sourceforge, so it's good to see it's still getting new releases!
- Cwizard 4y agoIsn’t it the default shell on macos?
- greggman3 4y agono? I'm pretty confident I had to set it to zsh when I got a new mac a month ago
- bjustin 4y agoYep, it’s been the default for a few years https://www.theverge.com/2019/6/4/18651872/apple-macos-catalina-zsh-bash-shell-replacement-features https://www.theverge.com/2019/6/4/18651872/apple-macos-catal...
- davweb 4y agozsh is the default shell for macOS Catalina and later. https://support.apple.com/en-us/HT208050 https://support.apple.com/en-us/HT208050
- mprovost 4y agoSure but that doesn't mean it's under active development. Before that it was an ancient version of bash that hadn't been updated in years.