This course has been updated! We now recommend you take the Full Stack for Front-End Engineers, v3 course.

Check out a free preview of the full Full Stack for Front-Ends Part 2 course:
The "Shells" Lesson is part of the full, Full Stack for Front-Ends Part 2 course featured in this preview video. Here's what you'd learn in this lesson:

Jem explores the concept of shells and the different types of shells that exist. As an exercise, Jem changes between a few different shells, and then exits to bash.

Get Unlimited Access Now

Transcript from the "Shells" Lesson

>> Jem Young: Let's talk a bit about shells. What is a shell? A seashell. A shell as we said before is a wrapper around a bunch of processes. It's the shell runs some sort of application, entered after the kernel and then spits back out, that's it. The shell does not directly talk to the kernel, generally.

[00:00:20] You don't want to do that computers are complicated, that's probably the best way of putting it. We don't write binary we can't understand exactly what is going on all the time so we have an application to do it for us. The shell is just a nice wrapper around that.

[00:00:33] So if we want to show our current shell we're gonna say echo $ 0 let's go run that see what's going on.
>> Jem Young: Echo dollar sign zero, and we're running Bash, which you should all be running Bash right now. If you're not, you did something very, very wrong.

[00:00:51] Bash is the standard. Talk about change? No, so talk a little bit about Bash. Bash is a standard of Come on a lot of popular warning distributions. There's a lot of different shells. There's, so there's the born shell which is the original written by I wanted to say Jason Borne.

[00:01:12] Because in the movie but I know it's not Jason, so someone name Borne. He wrote the bash shell, or he wrote a shell. But there's also seashell. Now that's C shell, that's C shell as in C-Shell. There's Z shell, there's Fish shell. There's a lot of different shells, I have a link somewhere in there about the different between shells.

[00:01:35] Which I kind of opening for google, which is a lie. Comparison of command shells. Yeah. There's a few. But this is a practical course. Don't worry about [LAUGH] don't worry about the different types for now. So we're on shells. So we know we're running the BAS shell. The BAS shell is short for the born again shell.

[00:01:58] So it's, the born shell was one of the originals, and it's just a better version of the born shell. There's also seashell which is, it's a bit more towards the user input, things like that. There is FishShell, TSH, I don't actually know what the difference is. There is a lot of them.

[00:02:14] In general you got to want to write bash and use bash shells because bash protectible, we know how it works. It has auto-completion, it has history, it has a lot of nice features to it. And Bash is just the standard. But if you wanted to, some people do, we can, let's just change those real fast.

[00:02:31] Kind of useful to know all of them. So if you cat /etc/shells, it'll show you all the shells that are available on your OS. All right, I'm gonna go ahead and change to the SH shell, it's real fast and I'll change it back. Let's go with cat slash etc slash shells.

[00:02:52] It even tells you valid login shells. So if you wanna change to Tmax or screen, I don't actually know what screen is, don' know everything. But you could if you wanted to, and this is just saying these are things you can log in as. You can set your shell to this and you'll be able to log in just fine.

[00:03:06] So if we wanna change the shell say change shell -s bin, change it to sh, cool. Now, because we're in a shell we won't see any changes yet. So what we're gonna do is we're gonna cheat. And we're just gonna switch to our user again, but we're actually opening up a new instance of a shell.

[00:03:30] No more friendly directory or things like that, and if you notice, if you go up on the keyboard, its not history anymore cuz this is a different shell. This is one of the things bass gives you the up arrow gives you which you've already written. And if we say echo let's see i it works here, yeah.

[00:03:47] Where we see we're in the shell. Now if we wanna exit out, we're back to our normal shell that we were in before.
>> Jem Young: But don't forget this last step. Because you will log in, and you'll be like what's happening? What happened to that, all this friendliness? 'Cuz we changed our shell.

[00:04:06] So when you exit and log back in, gonna have a new shell. Let's keep it at BASH. So let's just say, change shell dash s bin bash. And now we're good to go. If I su test, yeah, still in bash, cool. But we notice when we switch users we're always opening another instance of the shell.

[00:04:28] That means any process running by my former user is still running just the same. So when I switch to root I can exit I'm in a new shell running as root. But if I exit I'm back in my normal shell again. You can keep going all day. I don't know how many shells you can open before it starts complaining to you but you exit exit exit you're still in the shell.

[00:04:50] Okay, everybody understand shells a little bit more and kind of just they're a wrapper around the kernel, just a friendlier interface? And we have different ways to change shells. I don't recommend it unless you know what you're doing. But some people do, some people like the nuances of other shells, cool.

>> Speaker 2: Is anyone else seeing it just not change? When you do chsh.
>> Jem Young: Did you change, so you have to open a new shell with that user, so if you SU your user name.
>> Speaker 2: Okay. Gotcha.
>> Jem Young: You should see a new shell, and make sure you change it back, though.

[00:05:24] So change shell dash s bin dash
>> Jem Young: And if you wanna look, compare some of the command shells, there's a lot of them. Again, this is an intro class. I wouldn't worry about it for now, but in the future, if you get really, really good, you might say, I wanna run the fish shell cuz I'm cool.

[00:05:40] And I'll be like, you're cool.
>> Speaker 2: [LAUGH]
>> Jem Young: I don't even know the difference but that's awesome.