 We've got a lot of different shells available to us on Linux. By far the standard Linux shell is the Bash shell. It is the default shell on almost all GNU slash Linux distributions. The user shell sometimes varies. I would say 90% of the time the default user shell on your Linux system is also Bash, but some distributions are starting to experiment with setting the user shell to more modern shells. ZSH is the default user shell I believe in Manjaro these days. And you're even seeing some distributions now set Fish as the default user shell. I'm pretty sure Garuda has Fish as its default shell out of the box. And to be honest, I think that is a great move because as far as a user shell, you want the system shell to be Bash because most system scripts are written in Bash. It's kind of the de facto scripting language on Linux. So you don't want to remove Bash as your default shell. But for your user shell, it really could be anything. And I think the best interactive shell on Linux is Fish. One of the things I love about the Fish shell is that it has, you know, a lot of the features, the standard features a lot of people want like good tab completion and history. And it's almost predictive sometimes as far as I'll start typing something. You guys often see this in my videos. I'll just start typing a command and the Fish shell will predict exactly what it thinks I'm looking for. And it's really nice. And because that history file, as long as you never delete that history file, Fish will remember your history from the beginning of time until now. It remembers everything you ever tried. And I think that's really powerful. But today I wanted to tell you guys a little bit about some features that probably many Fish users don't know about. I want to show you some of the built-in functions that the Fish shell has. And I also want to talk about some of the built-in key bindings specific to the Fish shell that many users don't know about. So let me switch over to my desktop and I've got a terminal open. And of course my default user shell is the Fish shell. So this is Fish. Let's talk about some of the built-in functions for Fish. Every shell typically will have some built-in commands to it. Bash, ZSH, Fish. In Fish though, to get the list of all the built-ins, you can type the command built-in space dash dash names. And that will list all the built-in functions for Fish. Built-in by the way, that function is actually a built-in function. If I hit enter, it just listed out all of the built-ins. Many of them are very similar to some of the bash built-ins, for example. So you've got things like and, and case, or echo, else, et cetera. A lot of these are exactly the same as they would be in Bash as far as the names are similar and the functions themselves are similar. But you do have some unique built-ins. For example, count. That is a rather unique built-in specific to the Fish shell. If I did count and I gave it a list because you have to feed it a list. Count, for example, and then dollar sign path. How many items are in the path for the shell? In this case, the path for the Fish shell. How many directories are part of the path? Well, let's get a count. There are 11 directories part of my Fish shell's path. Another really unique built-in is math because by default, especially in standard POSIX shells like the Bash shell, doing math operations is either impossible or it's rather clunky. Well, in Fish, you just do math and you can actually do simple arithmetic. For example, 2 plus 2 or 2 divided by 2 or 2 minus 3. It'll even do negative numbers. One thing with the math function is doing multiplication is a little weird because if I did math 2 times 3, for example, I'm going to get it error. And the reason I get it error is because this asterisk symbol, which in calculators would typically be the multiplication symbol. Well, this is also used for file globbing. So it's a wild card character. So what you would have to do is you would actually have to quote that. So the shell knows that we're not globbing, right? That we're actually using that as a multiplication. So now math 2 times 3 would actually work. You could also use x to x3 for multiplication. But again, it's a little weird if I just do 2x3 with no spaces. I get an error because it's going to think it's some kind of like hex code. So you actually have to space out 2 space x space 3. And now the multiplication will work with the x character. Another built-in that could be useful under certain circumstances is random. Random gives us a random number. If I do man, random. And this is specifically the random command for the fish shell, right? Because there are other random commands. Other shells will have a built-in random. But the fish shell has its own random. And you can see it takes a range of 0 to 32,767 and gives us a random number. So that is its range. If I run random again, you can see I get a different random number. That could be useful. Specifically, if you were doing something with fish scripting, you may want to do the random command maybe to generate a random number for something. Now, two of my favorite built-ins for the fish shell are previousD and nextD. And that's previous. It's actually preVD and then nextD. So think of this as previous directory, next directory. So let me cd, I'm going to cd into downloads. And from here, I'm going to cd into slash etsy slash dtos. And from here, I'm going to cd into slash user, share, sddm, themes. Now watch what happens when I do previousD. I go back to slash etsy slash dtos. PreviousD again gets me back into downloads. PreviousD again would take me back in home. Now, if I do nextD, you can imagine we're going to go back in the other direction. And that is really, really cool. So those are some of the most useful built-ins for the fish shell. At least some of the ones I found good use cases for. Let's talk about some of the built-in key bindings for the fish shell. And I'm not going to cover standard shell key bindings like the Emacs bindings or the VI bindings that every shell, Bash, ZSH, Fish, they all have a set of standard bindings. I'm talking about some of the key bindings specific for the fish shell because it has some unique two-fish bindings. And one of the cool things, it actually has PreviousD and NextD actually key-binded because you don't want to actually have to type a preVD every time you want to go to the previous directory and NextD every time you want to go to the next directory, you want to hit a key-binding for that. And it's already set to the Alt key plus left arrow for PreviousD, right arrow for NextD. And if I do Alt left arrow, you see, I just went to the previous directory, Alt left arrow, the previous directory, Alt left arrow, previous directory, there's not a previous one before that because I've only been in four directories. But if I do Alt right arrow, I go back in the other direction. And that is a really quick and very powerful way to navigate the directory structure in the shell. In fact, I would argue that the PreviousD and NextD built-ins and the fact that they're key-binded to Alt left and right, I think that is one of the biggest reasons why as an interactive shell, you really should explore the fish shell as an alternative to things like Bash. Now I'm going to CD back into my home directory. And if I do an LS in my home directory, this is LS, this is actually ALIEST. My LS command is actually the EXA command, EXA. EXA is a LS alternative written in Rust, and it's got some flags and options, gives me some pretty output. So my LS, it's not really LS, but the cool thing about the fish shell is one of the built-in key bindings for the fish shell. If you do Alt L for LS, it will actually run your LS command. So if I do Alt L, it runs the LS command. Now that was hard to see because I already had run the LS command. So let me clear the screen. I'm going to do Alt L. It runs LS. And it runs my LS as it's ALIEST, right? It doesn't run the standard LS command. So if you have it ALIEST as something, it will respect your ALIEST. Now let me clear the screen. Now one thing people often do in the shell is when you're reading files, maybe you're catting out some text to the terminal. It's got a lot of output. Many people want to feed that through a pager. They want to pipe it into typically LS, right? So imagine I cat my .bashrc here. My bashrc is a very lengthy document. There's no way I could have, you know, read that. Maybe I wanted to pipe that into LS. Well, if I up arrow and get cat.bashrc, if I hit Alt P for pager, watch what happens. Alt P, it tags on the pipe symbol and the LS command to whatever I had just entered. And now I'm actually using LS. And now I can actually use the LS pager to actually scroll through this and actually read it instead of if I just fed it through cat, right? Then I'm starting at the bottom and I have to work my way backwards. So many people in the shell, again, often are trying to tag on LS to some output. And with this, with the fish shell, all you need to do is just hit Alt P and whatever command you were entering, it's going to tag on pipe symbol, LS. And I know some people are going to wonder what happens when you just do Alt P without actually entering something? Well, let's try Alt P. You can see it will actually default to the previous command that you had entered if you didn't enter one. But if I was entering something, for example, maybe I want to cat my ZSH history file. I don't know if I do Alt P. Again, it would just tag on the list command. I don't know what's in my ZSH history, so I'm not going to actually cat that out. Another interesting key binding, let me clear the screen, is say you're typing a command. For example, my LS command here. Maybe I don't know what that command actually does. Maybe I want a description of it. Well, fish has a key binding, Alt W. You can think of W as what is it? Alt W. And it will actually tell me what LS is. Now, if it's an alias, it's actually going to spit out what the alias is. You can see my LS command is actually alias to EXA with these various flags here. If I type EMAX and I do Alt W, it will actually tell me what the EMAX command is. In this case, I have EMAX alias to EMAX client and some flags. But let's give it a command that doesn't have anything. It's not aliased anything. For example, the H-top program. It's just H-top. It's not aliased anything. Alt W, it just tells me the description for the H-top program. Probably it pulls that from the man page is what I'm guessing. You see H-top. It's an interactive process viewer. Now, one thing you often want to do in the shell is you want to open up an editor. And oftentimes if you're working in a terminal, especially if you're using a command line editor like Vim, for example, it's no big deal to just type Vim and then the path to whatever file you want to take a look at. But my editor is not a command line editor because I use EMAX. And EMAX is, of course, a GUI program. It's a graphical program. So what happens if you have your editor and by editor I'm talking about dollar sign, editor, all caps, right? You have to have this set with your shell. If I do Echo Editor here, you can see I have that environment variable set to the EMAX client. Again, it's a GUI editor. And if I just want to launch that, I could type dollar sign editor, you know, in the shell and hit enter. Well, actually, that doesn't work in the fish shell. In the bashell, I'm pretty sure that would have worked. But fish has a key binding set to where if you do Alt-E for editor, watch what happens. Alt-E. Waiting for EMAX. And it just launched EMAX, right? The terminal is still there. I'm full screen the terminal is actually behind the EMAX window. But we launched EMAX, right? It's just an empty frame here inside EMAX. Let me colon Q to quit out of doom EMAX, right? Once again, Alt-E and EMAX comes up colon Q. One last key binding that is extremely useful, maybe the most useful out of the bunch other than the previous D and next D. I think a lot of people are going to use those for moving around the directory structure. But how many times are you looking at a file that's a protected file, meaning it's right protected. So you needed sudo privileges to do anything. But, you know, for whatever reason, you forgot to open it with sudo. For example, let me open with vim slash etsy slash pass wd. Now, maybe I wanted to edit this file for some reason, but I forgot sudo, right? Well, what I could do is I could go back to the command line. If I do Alt-S for sudo, watch what happens. We run the last command with sudo prepended to the front, right? And now it would ask me for my sudo password. Of course, I don't really want to edit that file. So let me actually just cancel that. Control-C to cancel. So that was just a few of the built-in functions and some of the built-in key bindings for the fish shell. It's the reason why I love fish as an interactive shell. I really think it should be the default user shell on every Linux system. I think all of you guys actually should explore the fish shell. And I know people in the comments are going to complain. It's not POSIX compliant. You don't have to write your scripts in fish, right? Everybody on Linux writes their scripts using Bash. I script using Bash, but that doesn't mean I have to use Bash as my interactive shell, right? I write my scripts in Bash. When I open a terminal, I want the fish shell, right? I want nextD and previousD and all of those key bindings. You know, because I don't need my interactive shell to be POSIX compliant. I'm not scripting when I'm just using the shell interactively, right? So interactive shells can be more modern. They can push the boundaries a little bit. And for that, that's really the reason these days I prefer fish over every other shell on Linux. Now, before I go, I need to thank a few special people. I need to thank the producers of this episode, Dustin Gabe James-Mant, Maxim M. Michael Mitchell, Paul West-Why-You-Bald, Alain Armour-Dragon, Chuck Commander-In-Reed, Dylan Greg-Marsh, Erion Alexander-Paul, Peace Arch and Fedora, Polytech Realities, Realize Red Private, Stephen Toulouse, Devler, and Willie. These guys, they're my highest-tiered patrons. Over on Patreon, they are the producers of this episode that you just watched. The show is also brought to you by each and every one of these fine ladies and gentlemen. All these names you're seeing on the screen right now. These are all my supporters over on Patreon because I don't have any corporate sponsors. I'm sponsored by you guys, the community. If you like my work, I want to see more videos about Linux and free and open-source software, like the FishShield, which is GPL'd. Subscribe to DistroTube over on Patreon. Peace. And unlike ZSH, you don't need plug-ins. This is all built into Fish.