11 ms·
Fish: A command line shell for the 90s
- llarsson 7y agoI love the way it predicts what I will write, how attractively it presents the predictions, and how it understands commands and completions based on man pages. But with decades of bash experience, I struggle with making even the slightest scripting in fish's own language for whenever I want to make a smart little addition to my environment.
- snide 7y agoSo somewhat unique experience. I'm a designer. I code. React and css mostly. I do use Vim which I guess is weird for a designer. I love Fish. I'm likely not their target audience. I've been using it for years. Since the early days in 1.x land for sure. The homepage has never changed and I still laugh at the tagline. I find it's auto-completion, history and niceties indispensable. I'm the person who asks you what the command is to rerun the tests. With Fish I never have to ask you again. I just remember part of it, and suddenly I've got it. I find its scripting language much simpler to follow than bash. I don't have a lot of scripts, but the ones I do are easy to manage. The only hiccup I get into is when I have to look up something on stack exchange, and of course the example is in Bash. These days though, with Bass and fisherman and so many other tools, i have options. Years ago I would explain to other code friendly designers, I'm weird, don't use this stuff. Go grab zsh. Lately though it's gotten very friendly. Really the only downside for a light scripter like myself is that need to convert bash examples to fish problem. Beyond that I feel it's actually a much nicer shell for new to terminal folks. Anyways, just an anecdote to add to the pile. Thank you to the devs that have supported it over the years.
- Aloha 7y agofish is my preferred interactive shell (I have window 0 on screen set to be fish), I still write all the scripting I do in bash, because I know it's probably already installed out of the box. Until you raised this point I didn't think if fish as something you'd script with.
- L0stLink 7y agoI really love the syntax and performance of fish shell, I had a few bash scripts that were used to manage the system volume notifications and power/battery information, as I use fish as my interactive shell, I ported them over to fish and tried to compare the performance, and to my surprise the fish variant was faster. I decided to rewrite the random wallpaper script for sway in fish too and it runs much faster then the original python snippet I got from swaywm's issues[0] (link to original python script[1]): #!/usr/bin/env fish swaymsg 'output "*" background ~/Pictures/Wallpaper/'(ls ~/Pictures/Wallpaper | shuf -n 1)' fill' I really love fish shell and find its multi-line input extremely valuable, I think it has a much saner syntax (I have no meaningful experience writing bash scripts), if you are like me in this regard I highly recommend writing your personal scripts in fish instead and if you are worried about posix compliance, it is not that different from a bash script with bashisms in that regard. [0] https://github.com/swaywm/sway/issues/1269#issuecomment-431671096 https://github.com/swaywm/sway/issues/1269#issuecomment-4316... [1] https://git.sr.ht/%7Esircmpwn/dotfiles/tree/master/bin/wallpaper https://git.sr.ht/%7Esircmpwn/dotfiles/tree/master/bin/wallp...
- manaskarekar 7y ago> With Fish I never have to ask you again. I just remember part of it, and suddenly I've got it. Are you referring to something other than cycling through history? In bash, hit `Ctrl+R`, then type whatever part of the command to cycle through history. You may choose to adjust the size of the history file in `.bashrc` as needed. A good reference: https://www.digitalocean.com/community/tutorials/how-to-use-bash-history-commands-and-expansions-on-a-linux-vps https://www.digitalocean.com/community/tutorials/how-to-use-...
- toxik 7y agoFish autocompletes history
- AnthonBerg 7y agoThe Fish interface for this is much more convenient and elegant and ergonomic.
- deleted 7y ago[deleted]
- dickeytk 7y agoyeah agreed. If you have trouble understanding how it could be better just install fish and try it for 5 minutes and you'll see what we mean. There are attempts to emulate some of it in zsh, but it's still not as good as what fish comes with out of the box. [1] https://github.com/zsh-users/zsh-autosuggestions https://github.com/zsh-users/zsh-autosuggestions [2] https://github.com/zsh-users/zsh-history-substring-search https://github.com/zsh-users/zsh-history-substring-search
- enriquto 7y agooh my god, i tried it and my terminal turned into a christmas tree! How can people actually work with such kitsch colors?
- AnthonBerg 7y ago
- tmysl 7y agoAs nice as fish is, it's not fully posix compliant, leads to some weird bugs here and there
- akx 7y agoThose are probably bugs you could report to the project.
- kick 7y agoThey're intentional. They have considered a compatibility layer in the past: https://github.com/fish-shell/fish-shell/wiki/POSIX-compatibility-thoughts https://github.com/fish-shell/fish-shell/wiki/POSIX-compatib...
- pmarin 7y agoFor interactive shells do not matter if is not POSIX compliant. I use csh (the really old one) as interactive shell.
- e12e 7y agoYes and no. One nice thing about shell, is that you can log your commands/look at your history - and easily automate tasks (turn an interactive session into a script). The only trouble is, such snippets have a way of sneaking into documentation, ci pipelines and other places. And then non-posix isn't quite as nice anymore. Even if csh or fish might be the nicer language. I do think the oil shell project is on the right track, by trying to "fix" shell (and fish is a great source of inspiration for the interactive part). Still, when plan9 didn't manage to take over, I guess I'm a bit sceptical about any new shell having much success...
- kbumsik 7y agoIt matters a lot when dealing with default environment variables. Even when expanding $PATH fish will give you much headache.
- deleted 7y ago
- aiyodev 7y agoIf you install fish, you should also install ohmyfish so you can install a good theme. I like bobthefish: https://github.com/oh-my-fish/oh-my-fish/blob/master/docs/Themes.md#bobthefish https://github.com/oh-my-fish/oh-my-fish/blob/master/docs/Th...
- mxschumacher 7y agoor sushi, I've been using that one for a few years: https://github.com/umayr/theme-sushi https://github.com/umayr/theme-sushi
- e12e 7y agoTo each their own - I'm so glad fish doesn't come with something like this out of the box! :)
- blondin 7y agolove fish. but love compatibility with bash most.
- phonebucket 7y agoLove this shell. Sensible defaults make it so quick to get up and running too.
- atemerev 7y agoYes, the only shell I actually enjoy writing scripts with. Bash is old and ad-hoc, and zsh is basically bash on steroids. Fish is something where actual language designers have sit and thought thoroughly how the shell language should work and look like.
- chrysoprace 7y agoFish is great, and it brought about some great defaults such as autocompletion and autosuggestion. The only drawback is the incompatibility with bash. The wonderful community made plugins that add these features to zsh (which IS compatible with bash), and it it's really great. My understanding is that there are still a couple fish features not implemented for zsh yet, but if you care about such things as bash compatibility then I'd suggest you give it a try instead.
- VvR-Ox 7y agoI agree. The auto-features should be default for bash as well as it would really help some novices to get more fun out of the experience learning to use a shell and also as an experienced user I wouldn't want to miss this. Because of that on every computer I have to work with for some time one of the first things is installing ZSH (and prezto).
- yoloClin 7y ago> My understanding is that there are still a couple fish features not implemented for zsh yet I'd love to know which ones! I was a bash user for 10 years, ZSH defaults put me off and it wasn't till I ran oh-my-zsh that I really learnt what I was missing, the following make me feel like a 10x-er ;) : - zsh-autosuggetions - zsh-syntax-highlighting - colored-man-pages Edit: And the `zstyle ':completion:*' menu select` autocomplete
- chrysoprace 7y agoI've not used fish extensively so I couldn't tell you. My statement is mostly based on impressions from other people who have also tried both. I should give fish another go and see how I like it, but the bash incompatibility is a deal-breaker for it to become my daily driver.
- einpoklum 7y agoCan someone give a few prominent examples of fundamental differences from bash? I don't mean trivial things like having `config.fish` instead of `.bashrc`, or not using fi and esac to conclude if and case statements. I noticed fish has: * extensive syntax highlighting * "global" variables shared by all instances of fish, persisting past reboots. what are other important features?
- atemerev 7y agoGood and well-thought shell language syntax (compared to ad-hoc hodgepodge of syntactic peculiarities of bash/zsh); reasonable defaults for the interactive shell. No other shell gives you this, for some reason.
- hnlmorg 7y ago> No other shell gives you this, for some reason. That's not true. There are a few other shells out there that do. The issue is the popular shells tend to be the ones that go for POSIX (or Bash) compatibility and those that do go for a syntax redesign (for example) often get criticised for not being POSIX compatible. There is comment further down in this discussion describing those syntax differences as "bugs" rather than "features"; which just goes to demonstrate how ingrained Bash et al are to Linux/UNIX command line users. Personally I see Fish and other non-POSIX shells like another programming language (arguably that's literally what they are). So switching from Bash to Fish - or whatever else - should be like switching from C++ to C#, Java, Rust, whatever. Sure there will be a lot of commonalities but it is the differences what makes the shift worthwhile. That all said, I can't blame people for preferring a POSIX or Bash compatible shell because that's what you'd expect to find on any Linux or UNIX system. Or at the very least a Bourne Shell (sh). Plus most documentation online will be tailored for compliant shells. However it does become a self-fulling prophecy where compliant shells are more widely used because they're already more widely used. I'm fine with this though. People who want to make the shift and learn something new can still do so under the knowledge that they're breaking from the norms and all the potential complications that might bring; and people who just want something that's universal and works - irrespective of it's warts - can continue to do so.
- airesQ 7y agoI feel like there is a big audience for fish with bash support. This could be a nice project; lets call it "shark".
- CJefferson 7y agoI want to love fish, but I get annoyed by the lack of true subshells. I love being able to write things like: (cd dir; make) & To start some stuff in the background, but with fish directory and variable changes in () don't stay inside the ().
- cormacrelf 7y agoThis comes up every time Fish makes it to HN. It still bugs me too. So does up-arrow skipping the first matching history item and having to use right-arrow for the ghost entry that shows up. These two are 100% enough for me to change shells, and I will. Fingers crossed NuShell does well!
- losvedir 7y agoWhat's the problem with right arrow? I use ctrl+e (a la emacs) to accept the ghost completion.
- istjohn 7y agoNot OP, but I find myself attempting to tab-complete Fish commands all the time. It's just how I've been conditioned by every other auto-completion interface I've ever used.
- cormacrelf 7y agoOk, here goes a rant. It isn't difficult to accept the completion. I'm complaining about an unnecessarily complicated mental model that is easy to trip up on, and requires much more thought to use. When you use zsh-history-substring-search, you can press up-arrow and scroll through history filtered by whatever you have entered so far. That is the end of the feature description. With fish, you have barely started. Up arrow scrolls back through history. With the enormous caveat that it doesn't show you the most recent one, which is usually the correct one; the list is physically split into head and tail by two different keys and two different UIs, so you can't just use it like a list, you have to remember what the top is so you can choose whether to read the ghost entry or to up-arrow and read that. If you know what the most recent one is, you shouldn't have to read anything to check, you should just be able to press the right sequence of buttons that does what you want to do. (I can never be certain that the ghost entry is actually the most recent one, because I've always thought it was frecency-based, probably because that's what similar-looking search tools (Google) have taught me. That's mostly my fault, but it's not something the UI was actually capable of teaching properly because without having to press up-arrow to see it, it is not linked to any particular list ordering; it is conceptually distinct and users are within reason not to see it as part of that list at all.) Up-arrow works differently depending on whether you have entered text in the line or not; no text and it show you the most recent, add text and it won't. And perhaps worst of all, up-arrow actually does show the most recently typed command, but only if the matching sequence of characters was not at the start of the line. Actually that's inaccurate -- if a command matches in the middle, but also as a prefix, you can't just remember that it matched in the middle and blindly press up-arrow. That's ghost-only. So there are in fact three different lists that up-arrow could be scrolling you through. Actual history (includes most recent); filtered history where last command did not have search term as a prefix (includes most recent); and filtered history where last command had search term as a prefix (does not include most recent). This is no longer a job for muscle memory. It's an active thinking exercise. So you have to remember the history stack yourself, including where in each line your search text will match, so you can stop and pause to think whether to press up or right at any given moment. I cannot think of another search UI that requires knowing where in a string your search term will appear, just for basic use. Ultimately, dozens of times a day, I stop to think about which button to press, and am reminded of this spectacularly poor UI, for which apparently nobody was able to express these sentiments in the four years that the GitHub issue was open. I don't believe the behaviour can be configured.
- ylere 7y agoI've been using fish as my default shell for a long time and recently started using it with https://starship.rs/ https://starship.rs/, which adds some niceties to the prompt without having to go overboard with customizing and configuring your shell.
- VLM 7y agoSomething not discussed enough is the competing concepts of shell as hyper customizable UI where fish wins, and shell as a light programming language for short casual scripting, where I kinda have to use standard uncustomized bog standard identical everywhere bash.
- resonious 7y agoThis might make me a bit of a freak, but the one thing keeping me from trying out Fish for real is decent vim bindings. I know Fish has vim bindings, but I found the feature support pretty lackluster and the behavior of some keys like 'e' to be inaccurate. I know some folks say that vim-style editing is overkill for a shell where you're often just submitting one-liners, but it saves so much time for me to be able to just jump right into the middle of a previous command and change one word without holding down arrow keys to get there. Granted, it's been awhile since I looked into Fish's vim mode, so maybe it's improved. Last time I checked, it sounded like it just wasn't a priority, since Fish's selling point is the intelligent autocomplete and such.
- raimue 7y agoIf you are working on a complex, long command pipeline, in bash you can use Ctrl-x Ctrl-e to open your $EDITOR to edit the line as needed. The commands will be executed as soon as you save the file and exit.
- achikin 7y agoAlt(Option)-e in fish does the same.
- Rebelgecko 7y agoAFAICT this doesn't work if $EDITOR includes any arguments
- armSixtyFour 7y agoI use vim binding in the shell a lot, typically for stringing a bunch of commands together. For replacing one word would using the `^` work? ex: `$ echo "hello"` > hello `$ ^hello^goodbye` > echo "goodbye" > goodbye
- nmstoker 7y agoPurely superficial comment: Thought they were being ironic with the 90s / Netscape / glorious VGA comments but maybe these really haven't been updated in an age. They've got screenshots not updated since 2006 (based on the release date in GitHub for release 1.21, given version 1.21 is show in one of the screenshots! You can also tell they're older from the chrome on the Mac terminal title bars)
- otakucode 7y agoI think they're just being honest. All of the features they boast were completely possible in the 90s. The only reason we didn't get them in the 90s was people not realizing they were so possible, or perhaps not wanting to leave their 70s style behind. A great deal of computing, especially on the *nixy side of things, is stuck in the past. Stepping back and looking at what you're used to and saying 'but how would it work if we were designing it from scratch today with all the hardware and knowledge we have now' doesn't often come up. And it's often seen as an attack on the older way of doing things for no good reason.
- WalterGR 7y agoFish was first released in 2005. They're being cheeky. It looks like the project didn't start calling itself a shell for the 90s until 2013. At least on the project's home page. Compare * https://web.archive.org/web/20130420050628/http://fishshell.com:80/ https://web.archive.org/web/20130420050628/http://fishshell.... * https://web.archive.org/web/20130521005841/http://fishshell.com:80/ https://web.archive.org/web/20130521005841/http://fishshell....
- YuukiRey 7y agoI use it as my daily driver and I've also started writing some smallish scripts in it. It's actually fun whereas bash always seemed rather tedious. I love how easy it is to parse arguments with `argparse` and to add completions through `complete`. Also fish utils like `string join` etc. are super helpful when writing small scripts. Shameless plug: https://github.com/cideM/fish-yvm https://github.com/cideM/fish-yvm yarn version manager written in fish