top | item 4073162

Fish: Finally, a command line shell for the 90s

442 points| rjshade | 13 years ago |ridiculousfish.com

146 comments

order

llambda|13 years ago

I've been using the original fish[1] for years. I'm very biased, I love fish for many reasons and despite the claims that zsh can do the same things I've never had cause to switch from it. Now it was quite disappointing to see the original fish project seemingly halted. So this isn't simply great news, in the sense that development has been picked back up in the fishfish fork, some great improvements have been made at the same time!

    * autosuggestion
      (this actually has a great amount of utility for me.
       it complements tab-completion quite well!)
    
    * optional web-based config
      (great for quickly editing your config settings)
    
    * speed improvements
      (although I never suffered from much lag with fish
       to begin with)
Overall I think the usability and utility of fish is greatly improved in this fork. Also it's worth pointing out that in terms of out-of-box functionality, some of fishfish features would be very hard to match. Things like autocompletion and simple history scrollback based one partial string matching set fish apart from the pack imo. So far, I'm quite impressed and I hope that more people adopt fishfish as the de facto replacement for fish.

[1] http://fishshell.com/

qznc|13 years ago

Have they found a better way for setting environment variables for single commands? The following bash command looks quite ugly with fish:

  LANG=C foo

g3orge|13 years ago

can zsh autocomplete man pages?

mhansen|13 years ago

I use fish (http://fishshell.com/), and it's amazing. However, they're missing the most important feature from their front page: Syntax highlighting!

Valid executables are colored green, as you type. Invalid commands are red, as you type. Valid files are underlined, as you type.

Like the carpenter who can feels the feedback of the grain of the wood through the handle of his plane can adjust his technique as he planes, fish shell lets me 'feel' the programs and files I'm working with through the shell.

And that makes me happy.

StavrosK|13 years ago

I stopped using fish a while ago, when it would crash whenever I opened a console session (so I couldn't do anything when X didn't start). I switched to zsh with fish emulation, but lately I realized I have a shell that takes much longer to start up and basically does everything fish does, and nothing more.

If fishfish is more stable, I'll switch in a heartbeat.

ralfd|13 years ago

A bit more context: Ridiculous Fish is an Apple Engineer on the AppKit team. He also has a nice hex editor for the Mac (Hex Fiend) and an interesting programming Blog:

http://ridiculousfish.com/blog/

zedshaw|13 years ago

Man, I used to use fish. It was great. It was like all the things people eventually make zsh do but in one convenient binary.

I think my favorite feature was that history was instantly shared among all your open fish instances.

ethereal|13 years ago

zsh used to do this for me (back when I used it; switched back to bash about a year ago now), and it was the most _annoying_ thing it ever did. My typical workflow (when working on a software project) involves a pair of terminals for compiling and execution, an editor window (whether gvim or kate/kile/kdevelop etc.), and a documentation terminal for manpages.

Oftentimes my execution lines are somewhat long -- enabling/disable debugging info in certain sections of the program while tracing programs, etc, and I'd not want to type them out continuously. As a result I'd use the command history a lot, muscle memory would automatically hit CTRL-P once I switched to one of my execution terminals. If I'd visited something in the documentation terminal in the meantime, I'd be staring at 'man 2 timer_create' instead of my expected './aesalon --set listen=6421 --set ::debug-shm --set ::debug-interaction'. The third-second or so I'd need to do a sanity check would seriously interrupt my train of thought.

It's neat, and I can see why people like it. But for my particular one use-case of terminals/shells, it was annoying. Took me about a week before I realized just how much it was slowing me down and disabled it.

[I probably should have just set up another zsh configuration for those particular terminals, but enough years with bash have trained me, I guess, to not expect it from my shell.]

mybuddymichael|13 years ago

What do you use now? And why did you switch?

ch0wn|13 years ago

I didn't get this right from the start, but this is a fork of fish(shell), which has been around for quite a while:

http://fishshell.com/

mixmastamyk|13 years ago

I'm on the fish mailing list and it has been well received by current contribs and the original author. I expect that the two forks will be one at some point.

0x0|13 years ago

Why did they pick the exact same name?

amix|13 years ago

If you run chsh and get error "/usr/local/bin/fish: non-standard shell" simply add /usr/local/bin/fish to /etc/shells. Just to save you a Google search :)

bstpierre|13 years ago

They need to update the slogan? "A command line shell for the 90s" doesn't really draw me in.

What I want to know:

1. In what specific ways is it better than zsh?

2. Is it absolutely, rock-solid stable?

Wilfred|13 years ago

1:

a. Superb readline colouring. Nonexistent commands are shown in red, commands that exist and are on PATH in green. Unclosed string literals become obvious.

b. A history search that is orders of magnitude better that Ctrl-r in Bash. (Though oh-my-zsh has the history-substring-search plugin which provides this functionality.)

c. Features work out of the box, fish helps you avoid managing a .zshrc equivalent file.

d. Tab completion offers hints. If I type l<tab><tab>, I get:

  leaftoppm  (Convert Interleaf image format to a portable anymap)
  less                                          (Opposite of more)
  lessecho                                 (Expand metacharacters)
  lessfile                        ("input preprocessor" for less.)
  lesskey                          (Specify key bindings for less)
  lesspipe                        ("input preprocessor" for less.)
  lexgrog                  (Parse header information in man pages)
(These summaries are the first lines of the man pages.)

2: I've only seen it crash on me once, which matches my experience with zsh. YMMV.

I used fish exclusively for a number of years, but eventually moved back to something sh-compatible. Too many wrapper scripts assume this.

adamc|13 years ago

When I saw the slogan, I thought it was ironic. I kind of like it.

calinet6|13 years ago

To be fair, it's "Finally, a command line shell for the 90s."

I couldn't agree more. We've been using shells from the 80's for far too long.

icarus127|13 years ago

I'm wondering about the answer to #1 as well. After trying this out for a bit there's nothing obvious and there are definitely things I miss.

eru|13 years ago

I tried fish a few years ago, but stopped for some reason that I can't remember. I will try again, and will either keep using it, or will remember why I stopped in the first place.

christiangenco|13 years ago

I'm so glad I'm not the only one that does this.

buster|13 years ago

Ahhh, finally. I used to use fish for many months, but after i figured that there is no development anymore, i switched back to bash...

Now it's time to change to fishfish and decide what's best suited for me! :)

edit: Also, i am disappointed that the ASCII-art fish on the frontpage is actually a picture and not ascii :(

egonschiele|13 years ago

Very poor support for alias:

    batman@batman ~/D/S/rails> alias foo="cd ~/"
    fish: Could not expand string '$tmp[2]'
    /usr/local/share/fish/functions/alias.fish (line 19): 			set body $tmp[2]
                                                                                           ^
    in function 'alias',
      called on standard input,
      with parameter list 'foo=cd ~/'
Makes me wonder what else I'll have to relearn to use fish. Can someone tell me if it's worth the effort?

Edit: didn't take me long to find something worse. I defined my aliases as functions, but apparently fish executes all functions when it sources the file? By putting this function in:

    function foo
    cd ~/
    end
I was able to send fish into an infinite loop.

ridiculous_fish|13 years ago

Howdy, author here.

fish doesn't have aliases, only functions. 'alias' is itself a function, which looks like it has a bug. I filed https://github.com/ridiculousfish/fishfish/issues/48 to track this.

(The usual way a fish user would add this function would be to put a file 'foo.fish' in ~/.config/fish/functions, or to use 'funced fish' to create one interactively.)

As for your infinite loop - fish certainly does not execute all functions when it sources the file. I wasn't able to reproduce your problem. Can you explain how you added this function?

Thanks!

AnthonBerg|13 years ago

I never use alias in fish, just functions - see the Fish design document, law of orthogonality: http://fishshell.com/user_doc/design.html#ortho

That infinite loop thing is a bug for sure, it shouldn't do that! I have defined that type of function to jump to the directories of current projects - that should work.

pooriaazimi|13 years ago

It totally worths the effort. It wouldn't take more than an hour, but even if it would take you 10 hours, it would still worth the time.

eru|13 years ago

That alias-example works for me with the current fish version from Arch-Linux. (And that seems to be the fishfish fork, from what I can tell.)

gurraman|13 years ago

It gives me great joy every time a new command-line-related project is released (or, as in this case, gets a major update). I will dedicate a few hours of my weekend to take this for a thorough spin!

herdrick|13 years ago

Why does xargs under fish not accept {} as a replstr like it does with bash?

    find . | xargs -I {} grep pat {}
On OS X fish this gives "xargs: replstr may not be empty" and on Linux fish I get "xargs: command too long". Using % as the replstr for example does work though.

AnthonBerg|13 years ago

The beauty of fish is that it handles lists much better than bash - it kind of has xargs "baked in". If I understand the example correctly, it finds every file under the current directory and greps for "pat" in each file.

In fish you could do this:

  grep pat (find .)
... or this:

  for i in (find .)
    grep pat $i
  end
The first example would work correctly in fish, but AFAIK it wouldn't work in bash. The is because every line from the command substitution is automatically escaped and quoted in fish. The small drawback is that a symbol-heavy commandline sometimes needs a few extra \ escapes - the power to handle lists of lines (i.e. lines from stdin or from command substitution) is bought for a little extra escaping. And it's a good deal IMO.

And the for loop in fish is so elegant and convenient that it's worth using for small random stuff.

(Everything I say is pending that I understand the find/xargs/grep example!)

rcthompson|13 years ago

I'm not sure why the recommended replacement string to use with xargs's -I is "{}". I just use "XXX" as the replacement string and stop worrying about how the shell is interpreting metacharacters in this particular case:

    find . | xargs -I XXX grep pat XXX

nikkaelle|13 years ago

Fish does brace expansion, even for empty braces. In order to actually pass braces to xargs, do:

    find . | xargs -I \{\} grep pat \{\}

desireco42|13 years ago

I just tried it out, I use zsh and don't really look for replacement, but my first impression is that things are much more snappy and significantly faster in fish. I liked how help opened browser, even though I was startled a little bit.

herdrick|13 years ago

Under the known bugs and issues:

History file should apply some kind of maximum history length

Fine, but the default needs to be large, like 100MB. Disks are big now. I hope ridiculousfish agrees.

ridiculous_fish|13 years ago

Hi, ridi here!

This bug is actually fixed with my changes (see the release notes at http://ridiculousfish.com/shell/release_notes.html). The maximum history length is now 250k unique items, with an LRU discard policy. A full history would be around 15 MB.

Processing time is one concern. fish doesn't do anything as clumsy as keeping the entire file in memory, but scanning a large history file can still add up.

But the larger concern is writing it out. fish saves its history atomically by writing an entirely new file to disk, and swapping it in. You may not notice a 100 MB file, but you would probably notice a frequent 100 MB write!

james4k|13 years ago

Disks are big, but I think 100MB is maybe a bit excessive...even 10MB gives you 40k lines of history, at 256 bytes per line, and that is a conservative estimate.

oofabz|13 years ago

100 MB is indeed small but there are privacy concerns with storing hundreds of thousands of lines of history. Do you really want every command you've typed for the last several years to be visible to anyone with physical access to your box? It could contain clear-text passwords to other machines.

I'd be happy with 100 MB as a maximum size but there should also be time-based limits, like remove anything from history that is older than a few months.

nickpresta|13 years ago

The package doesn't work on Debian testing/unstable/experimental: fish: /lib/i386-linux-gnu/i686/cmov/libc.so.6: version `GLIBC_2.15' not found (required by fish)

(I am running GLIB 2.13).

I tried compiling from source, but I am clearly missing dependencies. So far, I had to install:

libncurses5-dev, gettext, xsel, libxt-dev (alternatively, I could use --without-xsel and ignore these last two depends). You may want to add this to the project somewhere.

At any rate, I am looking forward to giving this a try.

maw|13 years ago

Maybe you already know this, but glibc and glib are two entirely different libraries. (The similarity in their names is unfortunate.) So be precise when asking for help.

mrgreenfur|13 years ago

Whoa. Just installed it and it's beautiful. I'm most surprised by fish_config which fires up a webserver to set config information -- awesome, really awesome.

rplnt|13 years ago

Unfortunately I can't try this right now, but do suggestions support something like taking only part of the suggestion? I.e. move left/right from cursor into the suggestion instead of writing. Shift+Arrow would work as expected, thus allowing quickly using part of the suggestion and writing the rest out if needed. It seems to be a better solution than deleting things from the end.

amjith|13 years ago

Can you add custom completions? I don't see proper completion for tmux sub-commands or git sub-commands.

Paul_S|13 years ago

This is missing the point of a shell by a mile. Extra features are nice. As an extra. Preferably on top of a rock solid platform that works everywhere, on everything, under any conditions. Same reason your PC boots in 16 bit real mode.

I'm quite happy living in the 80s.

archangel_one|13 years ago

Isn't this entire shell an extra? I wouldn't replace bash with it, it seems more like a nicer interactive frontend but you could always drop down to bash if it didn't work for something. Sort of like KDE being a more fully-featured frontend to X, but you can drop back to Fluxbox if you want to test X without all the gizmos.

jff|13 years ago

Your PC boots in 16 bit real mode because Intel is too locked into x86 to get rid of legacy modes and instructions. A proper architecture starts in its intended mode.

But I agree, adding all this fluff to a shell is a bit much. I use bash and keep ls colors disabled.

amix|13 years ago

When using auto-completion is there a way not to use arrow keys? Especially when completing a match it seems like I need to use the right arrow key. I would prefer not to use arrow keys at all, but use something like CTRL+(HJKL).

Symmetry|13 years ago

Well, the normal tab-based autocompletion works like you'd expect. You can go backwards in history the same way you do with the up arrow by using CTRL+P, and CTRL+N is the same as down arrow.

siteshwar|13 years ago

Yes, you can use Ctrl + F instead of right arrow key to autocomplete.

scribblemacher|13 years ago

I've never used anything besides bash before. I use a terminal a lot, but don't really do anything fancy so I thought switching would be a waste of time. Reading the features in fish though made me want to give it a whirl.

albertzeyer|13 years ago

Doesn't seem to be in Homebrew yet (I mean this fork; the original Fish is there).

That brings me to the question: What is different in this fork? Is it worth to use this fork or should I stick to the original?

TazeTSchnitzel|13 years ago

The features mentioned on the homepage were added to this fork.

fersho311|13 years ago

How to I remove it? I set fish as default, but I realized that none of my scripts in .bash_profile worked... and it's too much work to rewrite everything again.

shin_lao|13 years ago

I wonder if there is a modern shell with csh like syntax. I know this may sound anal retentive, but I prefer the csh syntax to the sh syntax.

fenprace|13 years ago

I've been used it. I think lazy people will love it.

Ideka|13 years ago

I tried fish some time ago. I thought it was pretty cool, but I didn't end up using it because it lacked Vi(m) key bindings.

neves|13 years ago

Anyone managed to make it run in cygwin? Bash completion in cygwin makes the shell very slooooow to start.

jameswyse|13 years ago

I've installed this on my Mac, love it!

danbmil99|13 years ago

Please, some budding genius, get fish to work with Cygwin! Then I can rule the world as fate intends.

rcthompson|13 years ago

So, is this new fish fully compatible with sh syntax? IIRC the original one was not.

mixmastamyk|13 years ago

No. I prefer its syntax, but since it is different from anything else I find it hard to remember. So I write my scripts in bash but use fish at the command line. Best of both.

kubov|13 years ago

Is there any possibility to provide vi mode? Like 'set -o vi' in bash.

q_revert|13 years ago

you could always put "set editing-mode vi" in your ~/.inputrc .. this has the advantage of affecting all programs which use readline, gnuplot, python shell, mysql etc.. I also put

"\e[A": history-search-backward

"\e[B": history-search-forward

in the ~/.inputrc which maps arrow up/down to history search.. more tips here http://vim.wikia.com/wiki/Use_vi_shortcuts_in_terminal

zsh has a better vi-mode than most of the shells I've tried, although I can't say I've made a serious attempt at using fish..

the color syntax highlighting implemented in zsh is much slower than the fish equivalent though, and can be quite laggy ime

pnathan|13 years ago

Ahaha. I like the sense of humor.

I shall have to give it a try!

sontek|13 years ago

Who doesn't package an RPM? >:|

Indianburger42|13 years ago

'cutting edge technology called threads' oh wow

AnthonBerg|13 years ago

:)

I'm sure you know that that's a joke ... ?

Uchikoma|13 years ago

"Watch out, Netscape Navigator 4.0!"

jmathes|13 years ago

I just tried fish for the first time, and it couldn't do the very first thing I tried to do, which was source my .zshrc. It doesn't have 'export', has some kind of nonstandard syntax for 'alias', and that was enough to get me to give up.

Since there are many fish fanboys here, and since it seems like it would be cool if it worked, I'm hoping someone can tell me the simple obvious thing I should have done. Can you help?

gammarator|13 years ago

Shell rc files aren't interoperable. .bashrc, .cshrc, and .zshrc work only with the shells named on the tin.