Installing Fish Shell on Ubuntu on Windows 10
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.
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.
- Generating a new SSH key and adding it to the ssh-agent
- Then go into GitHub and add your key https://github.com/settings/ssh. There isn't xclip support yet, but you can just cat ~/.ssh/id_rsa.pub for now.
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.
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.
About Newsletter
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.
lxrun /uninstall /full then lxrun /install. Now you have a new root filesystem.
Then we'll have superpower Linux machine on Windows 10
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.
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
Could you kindly give us some hints on how to add the Ubuntu Mono font to Powershell/Bash?
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
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?
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 $$
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?
https://gist.github.com/rubylust/6afcfa384b2b5489be7a3863fa3dd2f3
https://gist.github.com/rubylust/49f0d8fb3375321d98801490776c0138
Comments are closed.
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