Scott Hanselman

Installing Fish Shell on Ubuntu on Windows 10

April 09, 2016 Comment on this post [23] Posted in Linux | Open Source | Win10
Sponsored By

So hopefully by now you've heard that you can run Bash via Ubuntu on Windows...and not in a VM. You can run the Bash Shell and real ELF Linux Binaries (this is not emulation) on Windows 10.

I've recorded a 30 min video with developers from the project and there's a blog post from Dustin from Ubuntu about HOW this works if you want more technical details. You should also check out the Command Line Blog and subscribe and head over to User Voice to help pick the next features.

It's beta, but it's super fun. A common question is "hey bash is lovely but what about _____ shell." Right now as I understand it supports bash and adding other shells may not work, and if it does, you're hacking around. So, let's hack around.

I noticed this shell called Fish Shell and noticed that Ruby Nealon had Fish tweaked and running. I asked for some more detail and they were happy to oblige with a medium post. Thanks Ruby!

Let me give it a try.

Add the Fish Apt Repo and install.

I headed over to the fish site and did this.

sudo apt-add-repository ppa:fish-shell/release-2
sudo apt-get update
sudo apt-get install fish

Oh, and I also changed my Console Font to use Ubuntu Mono because

Note: I'm hearing it will be WAY easier to add new fonts as the console continues improving. The conhost.exe stuff improves console for everyone, including cmd.exe, powershell.exe, and bash. That console work includes VT100, ANSI, and other stuff, and is separate, but complementary to the bash work.

Nice font.

Bash on Ubuntu on Windows - Cats and Dogs Living Together Mass Hysteria

Because we're still launching bash, we need to use the .bashrc today to launch fish, so you'll need to add ssh-agent fish, and exit to your .bashrc if you want to try this.

OK, next, kind of unrelated to fish, but still useful, I wanted to setup git and ssh-agent, so I generate a new key, add it to ssh agent, following these guides.

Theming Fish

Ruby also points out that Fish has a "Oh My Fish" framework for packages and themes. You can get it easily:

curl -L https://github.com/oh-my-fish/oh-my-fish/raw/master/bin/install | fish
omf help

Ruby also included their own fish_prompt.sh file here for the "chain" theme that I installed with "omf install chain" as some glyphs rendered weird. If you want unicode characters like → in your prompt, make sure your files are UTF-8 and not ANSI or you'll get squares!

Now my prompt uses fish, has cool auto complete, nice colors, shows the git dirty bit and branch.

image

Yes, I realize there are literally fiftyleven billion ways to customize bash, zsh, and lots of other shells to do much cooler stuff than this. I too, am old, and I to have used *nix for years. But it was fun and easy to get fish running on Ubuntu on Windows. Thanks Ruby!


Sponsor: Quality instrumentation is critical for modern applications. Seq helps .NET teams make sense of complex, asynchronous, and distributed apps on-premises or in the cloud. Learn more about structured logging and try Seq free for 30 days at https://getseq.net.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service
April 09, 2016 12:21
Scott, I've never heard of Fish Shell, but it looks fun.

Speaking of Bash on Windows, do you think more people may re-discover it as a programming language in its own right? It can be so much more concise + quick than writing in a regular 'language' check out my comparison.. I'd be interested to know if it runs on your Windows/Linux?

Node.js vs Bash - coding challenge by RaspberryPi.org
April 09, 2016 13:15
Scott,

Do you know what to do when you mess up the Ubuntu environment? Is there a way to reset the root filesystem (redownloading and extracting the root filesystem like the first time)? I've tried to reset it by turning off and on the Windows feature, by deleting the lxss folder. Nothing works by far.
April 09, 2016 13:26
I found the solution myself. There's a lxrun command you can use in cmd.exe.
lxrun /uninstall /full then lxrun /install. Now you have a new root filesystem.
April 09, 2016 14:09
Bash on Windows is definitely da bomb!... Microsoft should have done this in the first place instead of Powershell.
April 09, 2016 14:36
Now we need tabs!
April 09, 2016 14:48
This is great news for the fish and fisherman community! Thank you Scott.
April 09, 2016 15:55
fish actually comes with it's own configurator that can be accessed by doing "fish_config" which will generate an html settings page that could be accessed by going to "%UserProfile%\appdata\local\lxss\root\.cache\fish"
April 09, 2016 16:29
Agree with @Rossi we need tab badly...
Then we'll have superpower Linux machine on Windows 10
April 09, 2016 19:59
Scott,

Do you think it is wise to introduce new bash users to a shell that is bash incompatible? From my experience, working with fish is frustrating for anything remotely complex. Much time will be wasted on why some script the user found online isn't working due to fish's bash incompatibilities. You might want to mention this in your post to warn users.
April 09, 2016 20:57
@ScottSchecter

Please give fish another chance. fish is different from bash, absolutely, but this is not incidental, this is by design. fish was not design to follow POSIX and that was on purpose. Are you familiar with fish design principles[1]? This is a must read even if you are just a shell dilettante as it explains fish's vision and reason to exist.

I am sure your experience is absolutely valuable and I am sorry you encountered only problems, but from *my* experience working with fish, I report success.

I don't know if my projects count as complex, but I have a handful of fish open source up on GitHub that hopefully can demo this shell's power and scope as well as its limitations; fisherman[2] and the fishery[3], etc.


[1]: fishshell.com/docs/current/design.html
[2]: https://github.com/fisherman/fisherman
[3]: https://github.com/fishery
April 09, 2016 22:53
Thanks a lot for this!

Could you kindly give us some hints on how to add the Ubuntu Mono font to Powershell/Bash?
April 10, 2016 12:35
@James P

Adding fonts to your console is something that has to do with the terminal application, not with your shell. Check your terminal application settings and look for a setting that let you select the font you want.

Make sure to download the powerline[1] fonts first.

[1]: https://github.com/powerline/fonts
April 10, 2016 16:04
@James P

If you follow Scott's link for the Consolas font, it will tell you how to change the font in the windows console. It will lead you here

https://support.microsoft.com/en-us/kb/247815

I have a slightly different issue, I can't change the keyboard layout in bash to match my own, anyone know?
April 11, 2016 23:09
I prefer tcsh but when configuring the default shell, what about the change shell command?

chsh -s /bin/fish

Once you log out and back in, you can run the following to determine your default shell was updated.

ps -p $$
April 12, 2016 5:14
Thanks for the cool info. I agree, bash should have been in windows from the start. heh.
April 14, 2016 20:09
Hi Scott

My console is acting weirdly. If I open Properties and change the font to Ubuntu Mono (which worked on the retail Windows 10 before I installed the Insider Build) it doesn't actually change. Open properties again and it's still on Consolas. I can change to Lucidia, but not Ubuntu Mono (I get the same thing on my PowerShell console, even though it did work on the retail Windows 10). Also, if I set the windows size in the Properties or Defaults dialog, the setting is ignored (it always opens a really small window of the same size every time).

Any ideas?
April 24, 2016 2:09
For anyone wondering why all the links to gists are 404s - the name changed from rubymeow to rubylust, the working links are:

https://gist.github.com/rubylust/6afcfa384b2b5489be7a3863fa3dd2f3
https://gist.github.com/rubylust/49f0d8fb3375321d98801490776c0138
April 30, 2016 14:24
The Article is awesome,very nice to read and understand and your postings are also nice.
April 30, 2016 14:26
How did you get such an informative information to express in your postings.
April 30, 2016 14:28
Nice One to read and understand thanks for sharing this article with all us.Continue Postings like this articles.
June 12, 2016 9:07
Nice and so helpful for all the people.
June 12, 2016 9:09
So helpful.Thank you so much for this article continue postings.
July 03, 2016 22:11
Thanks buddy for giving such an awesome stuff.

Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.