Fish Is A Modern Shell For The Sophisticated User

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so my shill of choice has always been bash the gnu bash the born-again chill but here lately i have been exploring some alternative shields and one that's really caught my eye recently is the fish shell for those of you not familiar with fish it is the friendly interactive shill if you go to their website fish shell calm you see the blurb at the top of the page says finally a command-line shell for the 90s of course they're being funny but they're also pointing out that things like bash & zsh know these other shells have a much older kind of look and feel where fish is much more modern and has a lot of built-in functionality that things like bash & CSH just don't have so let me switch to my desktop and let me actually open a terminal I'll zoom in here a little bit and this is the fish shell here in my terminal now when you first launch fish and you start typing you're gonna notice immediately that fish does some really interesting things so let's say I start typing maybe I want to do an LS and I start typing you see I get a LLL that's red and then I type s and now LS is blue well by default fish does this coloring where if you type a command that's invalid command it is colored in red and once you type a command that's actually valid it will change color to blue so that is a really cool feature the other thing is tab completion is built into fish out of the box so if I just typed a single LLL and I get a tab it's going to show me some of the ill commands that I could use you see it lists of about eight here plus there's a hundred and forty four more rows I could look at if I really wanted to view the full list you know I could tab through the full list and if I wanted to I could scroll down the full list but let's say that's not exactly what I wanted to do let's do LS and let's do maybe I want to do some flags with LS LS has a number of flags but maybe I'm not sure about the flags I want to use I could do LS and then the dash and then if I tab after the dash I actually get the flags listed here for tab completion for LS so not only do you have tab completion for the commands themselves you have tab completion for the flags if you need it and what this does is fish gets the the flag information from the man pages it parses all the man pages that are installed on your system and that way you know you have this information available to you anytime you need it with a simple tab now you see some of the coloring that's going on with fish fish has true 24-bit color let me control c2 to kill that command that I was beginning to type there one interesting aspect of fish is some of the built-in commands to fish it has some extra commands that are not included in things like Bosch and zsh for example if I get a echo and let's say I want to echo hello world and I hit enter of course that's just your standard echo command but if I wanted to I could do a echo and then I'm gonna run this command set underscore color and I'm gonna tell it to set the color to green and then in quotes hello world and you see it changes the output from that echo command to green if I wanted to I could change it to any color I wanted to I could do magenta and now hello world is a purple another interesting built-in command to fish is math so if you type math you know just math with no arguments gives you nothing it says hey we expected at least one argument after math well you could do math and maybe you want to do a calculation maybe you want to do one plus two and it returns three if you wanted to do 1 divided by 2 you could get 0.5 and this is really nice because it is kind of tricky and some other shields to actually perform simple math calculations well not the case in fish you just type the word math and then perform your basic math calculations right here in the shell one of the best features about fish is everything I've shown you this bar the tab completion with the commands the tab completion with the flags the set color command the math command and all of this stuff is built into fish I didn't have to configure anything to get any of the stuff you've seen on the videos so far the only configuration I have personally done to fish is the prompt here this is obviously a little bit jazzed up prompt showing you a little bit about what the prompt is doing most of its pretty self-explanatory the directory I'm yen and what branch I'm in as far as the git repository because my home directory is a git repository other than that you're gonna be confused about that green box with the capital I so fish has VI mode vim mode kind of like bash and CS hm any other shell but the great thing about fish is in the prompt you can actually have it tell you whether you're in insert mode or normal mode when you're doing VI mode in fish so obviously the green box with the eye is telling me I'm in insert mode so I can actually type something if I wanted to I could hit escape and now you see I get a red box and I've got a capital in and this is tells me I'm in normal mode and now you know I can do all my standard them kind of command so CW to change word so it escaped to get back into normal mode like a DD to get rid of the line and then of course I to get back into insert mode now where did I get my prompt I got my prompt by installing a package called oh my fish you guys that are familiar with the CSH knows there is a big set of plugins for CSH called oh my zsh which installs like a million plugins oh my fish is something similar but it's much more minimal when you install Oh my fish it's just a framework for installing prompts for the most bird for installing themes they're not automatically installed when you install Oh my fish it's just a way to make installing things a little easier basically you run this one command here with curl and you have oh my fish installed on the system it is that easy and then all you need to do is if I run OMF for o my fish it really doesn't do anything but it tells me the commands I could have ran with OMF let me clear the screen om f theme will tell you all the themes that are installed on the system and all the themes that are available now by default you're not gonna have any installed you know that your to have a gigantic list of things that are available but nothing will be installed by default now I've installed about 30 or so themes just because you know on the website on the oh my fish website I couldn't find like any screenshots to actually show me what these prompts actually look like so I had to install them to see them and I could remove them if I really wanted to but they're really just text files on the system so it's not like they're taking up any space the prompt I'm currently using I believe is the sashimi prompt and you see it's different colors here everything else is blue and this is more of a light green color that is letting me know that that is actually the current activated theme if I wanted to install a different theme you know all you need to do is OMF and then install and then whatever theme you want to install say I wanted to install fish face it's not currently installed I don't really want to install that because it's gonna change my current prompt but hey let's do it just so you can see what happens you see actually we clear the screen the prompt is now this s key fish well I actually wasn't expecting that that is actually kind of cool but you know what I kind of want to go back to the sushi me prompt here so let me do that and it says uh sashimi is already installed but it switches to it one thing we should note here is that fish does try to improve on shell syntax so if you want to actually script with fish the syntax is actually a lot cleaner and a lot more intuitive which is a real positive now the real negative is if you're used to just standard POSIX shell compliant scripting or bash scripting a lot of the scripting that you were used to just will not work in fish so if here in the fish prompt I wanted to do a typical if statement so if I wanted to do if then in brackets I'm gonna do you know what how about we do editor if my editor equals and I think I have my editor equal to neo vim pretty sure I do in typical shell scripting bash scripting especially the next thing you would do is if editor equals neo film you then and then you give it some Khmer why don't we echo my editor is in Veeam and then we need to do else if my editor is not in them then we will echo my editor is something else and then typically you end your if statements with if reversed fi now that would actually do something in bash when I hit enter it does absolutely nothing here in fish right that that's that's a malformed argument there let me open up another terminal here and what I'm gonna do is I'm gonna launch bash clear the screen so this is bash and the second terminal here I'll zoom in and what I'm gonna do is I'm just gonna paste what I just wrote that if statement and you sleep in bash it works just fine you know it runs this if statement just fine and I get returned my editor is indium so my editor is set to Neoga they close them so how do you do an if statement or a case statement or wall or until or whatever kind of block statements you want to do in fish well the first thing you need to know is you no longer need to type F I at the end of a if statement you no longer need to type e sack at the end of a case statement now fish does this in a much more sane way anytime you do one of these block statements that if statement a case statement the very last thing you type is not the word in reverse what you actually have to end it with is the word end if I do it up arrow will it actually won't give me that that script again but I could copy it save me from typing so I'm gonna enter all of this back in here and the first thing you need to do is get rid of the ephod and write the word end the next thing I want to do is get rid of the line that says then we no longer need the path in which kind of makes sense I mean why do you really need ya know like if then do this I mean we kind of know if I'm doing it if statement and it's obviously I want to do something after it so get rid of the din and then get rid of the Fi and just end it within and if you run that the script actually runs correctly you see I get the correct output my editor is in so it's just something to be aware of you guys that are used to standard POSIX shell scripting I know that's gonna be frustrating at first but you know once you get used to it I mean that's a pretty simple correction there for the if statements like now that I've done it a couple of times I will always know what an if statement and fish looks like I'll know not to include the then and then always include the word end at the end of the if statement one other thing I should mention I mentioned I installed Oh my fish to theme my fish shell but you guys if you don't want to bother installing the oh my fish plug-in you don't have to fish has this really neat thing it has a built in web browser configuration tool built into it all you need to do is when you first launch fish type the word fish underscore config and if I hit enter it's gonna launch my web browser on a different monitor but it launches basically this local host website where you can pick your prompt your colors you know various functions that you want to do on all of this now I actually don't want to do any of this so I'm actually just gonna kill that tab and get rid of that clear the screen here let me close my terminal make sure it didn't overwrite anything now it looks like everything's still the same now one of the things you kind of want to do is probably set some aliases you know the kind of standard stuff you doing like your bash or C or Y or Z SHRC now since I have o my fish installed what I need to do is I'm gonna see to e enter Mike dot config folder and in my duck config folder I have a fish folder I accidentally hit tab there when I didn't need it but I have C deed into the fish folder let me LS you see there is a folder in dot config slash fish called comp dot d and let me see D and to that do an LS and in that directory I have om f dot fish let me open that in them and I haven't done a lot with my fish configure but I did add all my aliases the standard aliases that I use in both bash and CSH I just ported them over to fish but one of the things I wanted to do was set my default editor and set my default terminal here in fish and right away when I set these the way I thought I needed to set them I got errors and let me open up my patch or see typically and the bass show you know when you set something you know you're gonna do editor equals for example and then in quotes in them so editor equals knee ovum but if you notice in fish you need to include the word sit editor and no equal sign if you add the equals son it's gonna just throw up some errors again fish has some some quirks about it you know you got to understand that fish is not bash it's gonna be one of the things it's like anything else though when you learn something new you know it's foreign to you at first you gotta kind of learn the little nuances so will I leave bash behind and move to fish I probably will for a little while you know I'm gonna give fish a real chance here so I'll probably live in it for a few weeks I've used other shells other than bash I mean I've used the sh t sh s the default shell on some systems and like I said typically I just go with whatever is there anyway but you know I'm fine with bash I'm fine with zsh I'm sure I'm gonna be fine with fish again it's a little foreign at first but really once you kind of know the ins and outs and some of the basics with the scripting and you know how fish does things a little differently than bash or zsh you're fine but honestly fish gets a lot of things right there right it's cleaner it's simpler it's more intuitive I mean you guys if you haven't tried out fish install it go ahead and try it out I think you guys are gonna be amazed I think you're gonna be absolutely delighted at all the built-in features you get all these features that are built in that are just not there in bash or CSH unless you spend hours and hours of configuring and installing all of this external crud we're fish out of the box it just works now before I go I need to thank a few special people this show was produced by Michael Mitchell Chris DJ Donny Dylan George Kaplan Nate lambda Libra Quest Emery Rob Sean and Willie these guys they are the producers of the show these guys are my hi steer patrons over on patreon without these guys this episode about the fish hill wouldn't have been possible I also want to thank you each and every one of these names you're seeing on the screen here each and every one of these ladies and gentlemen help support my work over on patreon if you'd like to support the channel please do so you'll find me at distro tube over on patreon alright guys peace you
Info
Channel: DistroTube
Views: 130,908
Rating: 4.9219036 out of 5
Keywords: fish, friendly interactive shell, fish shell, linux, gnu linux, bash, bash shell, zsh, z shell, bash vs fish, zsh vs fish, macos shell, command line, terminal, oh my fish, shell prompt, shell theming, linux shell, best linux shell, fish shell tutorial, fish tutorial, fish commands, fish command line, fish config
Id: ux1SP9B5lSQ
Channel Id: undefined
Length: 15min 55sec (955 seconds)
Published: Thu Apr 09 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.