 Today, I want to clear up a little bit of confusion about the shells on Linux because you see this all the time. Any time a discussion comes up about, hey, what's your favorite shell on Linux or hey, what shell are you using on Linux? You know, people will talk about shells like Bash and Fish and ZSH and Corn Shell, KSH, C Shell. You've got all these various shells that are available to use on Linux should you choose to use them. But invariably, anytime there's a discussion of which shell do you use or which shell is your favorite, somebody will respond with, I use slash bin slash SH or sometimes they'll just abbreviate it. I use the SH shell, right? And SH is not an actual shell. SH is not an actual program at all. SH is actually just a link. It's an alias essentially. It's a link to whatever happens to be the default shell on your system. That's all SH is. SH is not an actual program. So when you say, I run SH, that is kind of meaningless. That doesn't really tell the user what your default shell actually is. So let me switch over to my desktop and I'm going to go ahead and launch a terminal and I'm going to zoom way in. So let's talk about the shells that are available on your system. How can you figure out what shells are available on your system? So you can do a CHSH, that's the change shell command and give it the dash L flag for list all the available shells on the system and you will have some duplicates because you will have binaries in both slash bin and slash user bin. But typically you want the slash bin versions and you can say I have slash bin slash bash. So I have the bash shell available. If I want to set that to my default user shell, I also have a ZSH available slash bin slash ZSH and I also have slash bin slash fish. So I have bash fish ZSH available. If I want to set my user shell to one of those, that's fine. You can really change your default user shell to anything. The default user shell doesn't matter. Now the default system shell. Now that's the shell that is the default for your systems root user. Now that I strongly urge you just to leave that alone. Now to find out what your user's default shell is, there's a couple of different ways you can do this. First, you can just echo dollar sign shell all caps and that is the default shell for the user you're currently logged into. Now that's not necessarily the shell that you're currently running. I could be running the bash shell right now and if I do echo dollar sign shell, it's still going to return slash bin slash fish because that is my user's default shell. That's when he opens a terminal or drops to a TTY, he defaults to being an official but if I switch over to bash for example and do echo shell even though I'm in the bash shell, the echo shell command is still going to give me slash bin slash fish even though that's not the shell I'm currently running. Another way you can get the default shell for your user or for all users on the system really is you could just cat a file. I could cat the slash etsy slash pass wd file if I can type it correctly and that lists all the users on the system. It's a very convoluted file. All the values are separated with colons but you can see the very first user is the root user and his default graphical system is the X11 graphical system. His default directory on the system is slash root. His default shell on the system is slash bin slash bash. That's what all those values mean. If I wanted to find my user and I could scroll down here and let's find the DT user. Here is DT. You can see his user ID is 1000. His home directory is slash home slash DT and his default shell is slash bin slash fish. So now I know the default system shell on my system is bash. The default user shell is fish. But let's talk about the confusion that comes with SH. People claiming that their shell is slash bin slash SH or their shell is just SH, the SH shell, right? Well, let's do a where is SH. So where is gives you the location to the binary for a particular program. So where is SH tells me that the binary for SH is in user bin slash user slash bin slash SH. Well, let's see the over to slash user slash bin. Let's do an LS and if I do an LS, there's a million binaries in slash user slash bin. So let me up arrow and do an LS and let's grip for SH. And now the list is much smaller. Let me scroll up to where SH is in the list. And here it is, user bin SH. You can see it's not really a program. It's not really a file itself because if you look at the read, write, execute permissions, RWX, RWX here at the very front of the permissions you have an L that signifies that that's really a link to another file, another program, right? So that's a link. SH is not a program itself. It is simply linking to bash, right? It just redirects to user bin bash, right? That's all that does so. Now let's talk about changing your default user shells and your default system shell. I recommend never changing the default system shell. So on GNU slash Linux systems, the default system shell is universally the de facto is bash. It's bash 99.9% of the time the root user and the default system shell on a GNU slash Linux system is the bash shell. And I wouldn't change that because all your developers for your Linux distribution, they expect bash and what they know bash is the default shell. So they're writing a lot of shell scripts with bash in mind. They're using bashisms, right? They're writing using the full power of the bash scripting language because bash is a much more complete, feature complete scripting language than just POSIX compliant shell scripting. So why not use it? And especially when you know it's going to be there on the system. So a lot of your scripts on a Linux system kind of expect bash to be there. So don't change the default system shell from bash. And I really wouldn't remove bash from the system either. That's sometimes people do that and because so many scripts are going to have slash user slash bin slash env bash as the shebang in the script, meaning the script needs to execute with bash in mind, find bash on the system and run this script with bash is what that shebang means. And if you don't have bash installed, it's going to have a problem running that script, right? So don't change the default system shell and definitely don't remove bash from the system. But your user shell, you absolutely can change that. No harm, no foul, you can change your default user shell, my DT user. I can change his shell to whatever. And there's really no chance of me doing any kind of permanent damage or getting into a situation where things are completely messed up. So to change your default user shell, you might need a sudo privileges. But I'm not sure if you could do this without sudo privileges, but it's the change shell command. And instead of dash L for list all the shells dash S for set. And then I could do slash bin slash bash because right now my default shell is slash bin slash fish. So if I wanted to change the DT user's default shell from fish to bash, that's how I would do it. Or if I was already defaulting to bash and I wanted to change to ZSH, that would change my default shell to ZSH. Meaning every time the DT user would open a terminal, it should default him to that default shell. So if it happened to be bash, I would default to bash. If it happened to be fish, I would default to fish. Now I didn't change my shell, so I'm in the fish shell right now. So let me clear the screen here. Let's talk about Echo shell, the limitations of that. Now Echo shell will give you what your current user's default shell is, but that does not actually tell you what shell you're currently running. So I demonstrated that earlier. How would you determine what shell you are currently running? Well, let me switch over to the bash shell. For most shells that are posits compliant, kind of posits compliant, things like bash, things like ZSH, you can simply do a echo dollar sign zero. And it should return the name of the shell. So echo dollar sign zero, if I run that inside bash, you can see I get bash. If I switch over to the ZSH and do echo dollar sign zero, it returns ZSH. Now let me exit out of ZSH back to the bash shell that I was previously in. You could also run this command ps. Now this is the processes command. Give it dash p and then look for the process dollar sign, dollar sign. So it's basically find the shell name. Find a process named after the shell that we're currently running, I think it's essentially what that expands to. But you can see it runs the ps command and it finds the line that includes bash because I was in the bash shell. Now if I was in the ZSH shell, ZSH, it would find the line that contained ZSH. I can demonstrate that. So we'll switch over, do ps dash p, dollar sign, dollar sign. And now it's going to find the line that contains ZSH. So it gives me the process ZSH. And that pretty much tells you that hey, we're running ZSH as our shell right now. Now if I exit out of ZSH, exit out of bash, I should be back in the FISH shell. Let me do a echo dollar sign zero in the FISH shell. Nothing is returned. So the FISH shell is a little different. It's different than most other shells. So the echo dollar sign zero command does not work. Also the ps dash p double dollar sign command does not work in the FISH shell. I can demonstrate that as well. And you can see the FISH shell just complains about that command. But the good thing with the FISH shell is it gives you an idea of what the problem is. It tells you hey, dollar sign, dollar sign is not the process ID of the shell that you're currently logged into. Not in FISH. In FISH, they have their own variable for that. And that is dollar signed FISH underscore PID. Process ID. Oh, well thank you FISH shell for telling me that. Now that I know the proper variable, instead of the two dollar signs, just do a single dollar sign FISH underscore PID. And there you go. And you can see we get the process for the FISH shell, meaning I'm currently running the FISH shell. That would also work for echo instead of dollar sign zero. You could do FISH underscore PID. It won't return FISH as the name, but the fact that you get the process ID for the variable FISH PID, right? That would also give you a clue that hey, right now you're running the FISH shell. So that's just a little bit about the shells that are available to you on your GNU slash Linux system. And again, I just wanted to clear up some of that confusion as far as, you know, your default user shell, your default system shell, and the fact that yes, there is a binary SH that links to the default system shell on all Unix-like operating systems. But SH is not an actual shell. It's not an actual program. All that is is a link to whatever shell happens to be the default on that system. And again, on 99.9% of GNU slash Linux systems, SH is simply a link to the bash shell. On the BSD operating systems, it's probably a link to either KSH or TCSH. Now before I go, I need to thank a few special people. I need to thank the producers of this episode. And of course, I'm talking about Gabe James, Matt Paul, Steve West, Arkotic, Armor Dragon, Commander, Angry, George Lee, Matthew Methos, Nate Erion, Paul, Peace, Archimator, Realities for Less Red, Profit, Rolling, Soul, Astray, TNRen, Tools, Debbler, Warranty, N2N, Ubuntu, and Willie, these guys. They're my high-steered patrons. Over on Patreon without these guys, this quick little rant about your shells on your GNU slash Linux system, it wouldn't have been possible. 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. I don't have any corporate sponsors. I'm sponsored by you guys, the community. If you like my work and want to see more videos about Linux and free and open-source software, subscribe to Distro Tube over on Patreon. Peace, guys.