Terminal vs. Bash vs. Command line vs. Prompt

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so this is a highly important video if you do not want to look like a fool on the Internet if you're a new user to Linux or if you're doing any kind of development stuff or even if you're using Mac OS frankly there are some basic terminology that I've in my time on the Internet I have realized that people serially misuse some basic concepts so I want to make them clear specifically about the terminal what is a terminal what is a shell what is bash what is you know what's a command-line what is a prompt those are all technically different things and a lot of people who are new use those terms incorrectly and it actually gets them into a lot of confusion because they don't know how I asked for things and other people will hear them misusing terms and think they're dumb okay so I'm gonna explain if you're a new user even if you're not and you secretly have something to learn that you don't know about I'm doing this video for you so here's where the confusional arises I just brought up a window well this window is a terminal emulator it also is running it might be running a shell like bash usually if on your machine if you don't know what you're running you're probably running bash on my case in my case I'm running zsh so I brought up zsh I brought up a terminal I brought up brought up a command line and I brought up a command prompt all of those different things are different and it's important to know that this the difference between them firstly the terminal is really it's really short for the terminal emulator because this little program the actual window that comes up that you have stuff running in that is your terminal emulator and that's emulating what a old classical terminal looks like where you you know put commands in and stuff like that theoretically of course terminal emulators might be doing other things in addition to that but the terminal emulator is the program the window that is floating on your screen okay that is different from bash okay that is absolutely not the same thing as bash so the terminal emulator is the window bash is the language that runs in most terminal emulators okay well bye or at least you have it start by default when you bring up a terminal emulator in most cases so if you want to know what you're running what language you're running you can type in echo dollar sign zero in my case I'm running zsh but if you don't know what you're running you're probably running bash so you can see that or in the weird circumstances you might just be running bin SH without anything in front of it although if you you're running that you probably know that you're running that unless I guess I think bin SH is default on like Ubuntu if your root or something like that but anyway so the difference between bash and zsh which are languages and a terminal is very there's it's a very important distinction let me put it this way let's say here's a here's a newbie question a newbie question that is would be would fall under the definition of a stupid question how do I copy and paste in bash that is a dumb question let me explain why it's not bash is a language you don't copy and paste in a language you copy and paste the bindings for you're copying and pasting come from your terminal emulator it is specific to this graphical program that's running and you can copy and paste things from it and input it into whatever you're doing that has nothing to do with bash it has nothing to do with the shell so if you ask a question like how do I scroll up in bash or how do I copy and paste or something like that or how do I change the background color of bash those are all those do not make any sense bash is merely a language that often runs in command prompts okay so in my terminal emulator if you want to so my terminal emulator happens to be my build of St the simple terminal and in my terminal emulator if I want to copy something I can highlight it and I can press Alt + C and I copy it so if I want to paste that in I can press alt V and that's how I paste that is probably not going to be the exact bindings on your machine I think most terminal emulators will have Control Alt C and ctrl alt V or sometimes shift insert will be another way of pasting something one thing you will never ever see though is here's an example okay so I'm gonna have a little command so sleep v and echo lmao so that's gonna sleep a wait for 5 seconds and then print lmao so on all UNIX based operating systems you know that if you have a command that takes some time to run like this one I can press ctrl C and ctrl C is gonna stop whatever it's doing ok so since that has been taken since when you know shells were first invented you are not going to have that as your binding for pasting something in ever ever in any kind of terminal emulator because basically bash has this setting has control C as a binding that it's always going to have so no terminal emulator in its right mind would ever bind that same key ok but keep in mind those are different things so what else so another thing that people ask about is this little thing here what's this thing before actually it'll be clear what's a command line ok a command line is the line that we're actually typing on here so a command line it isn't just about terminal emulators it isn't just about bash or anything like that because I could open up another terminal emulator I'll do this so again st is my terminal emulator and i'm gonna open an instance running Python over here I can type commands that are in the Python language as opposed to bash and it will run them this is a command-line interface on the left and this is a command-line interface on the right what's the difference they're running different languages the one on the right is running zsh or in your case it might be bash the one on the left is running Python now languages like bat there's a reason we use languages like bash for every once in a while ok here's what happens this is another noob thing and I can't help but laugh at it there are a lot of people who will be like they'll take computer science 101 they'll learn some Python and they'll be like I like Python I want to have Python as my default program that I run in my terminal emulate and that's it's such a silly thing even if you love Python languages like bash shell which is the original bash add some stuff on and zsh adds some more stuff on there those are kind of language I'm not gonna go into it that much in this video but those are languages that are uniquely built to be very nice and terse for a command-line interface Python is really a language that is supposed to be written in a file and then you run it all is one thing in a script it is not as efficient at getting things done on the command-line specifically you know Python to put functions and functions it's a huge pain but piping on the command line is a much easier thing either way that's we'll talk about that in another video let's key let's keep it to the basics so anyway the both this and Python have a command-line interface another question you might want to have or it what is this thing here this little color stuff with my name in it this is just it goes by different names you can just call it a prompt sometimes and it's merely decorative although sometimes people will have information in it depending on what kind of shell you have but this is something specific to each one of your shells so what happens is when you install an operating system when or really when you open bash bash is gonna look at a config file for all the information that you know it's gonna run at the very beginning so it knows what kind of configuration you want and one of the things you can change is this little prompt here now it's sometimes called a PS one and the reason it is is because if we set the variable ps1 let's say we set it to lowell what that does is it changes your prompt to lowell so that's what PS 1 means okay we can change it or we can say PS 1 equals you know just some text something like that and in that case it's gonna set oops I mean PS 1 it's gonna set your prompt to whatever that is now how I got all this color here is because on shot some shells like zsh you have the ability to give set your PS 1 to different color codes you can do this on bash as well but at the CIN hacks of it is not exactly the same so when you say something the reason I bring this up is because a lot of people will say something like oh people will install my terminal emulator which is this thing here which of course comes with things like bindings for scrolling up and pasting and copying things but one thing it does not have is this prompt because this prompt this prompts are always built into shells and in your shells configuration file that is where you set what your prompt is going to be you just say it make my ps1 look like that so a lot of people will install my terminal emulator and ask me Luke I installed your terminal but I don't it doesn't look like that in there talking about this thing here that's not how that has nothing literally nothing to do with the terminal emulator whatsoever these prompts are set in shells like bash and if you want to look how to change them look up how do I set how do I change my bash prompt it actually is a sort of complicated syntax they even have bash prompt generators you can look up but it has nothing to do with the terminal the terminal emulator so anyway that's in general the the confusions that people have that is mostly it's a failure to distinguish the language that runs in a terminal emulator from the terminal emulator itself terminal emulators can run lots of different things they can even run you know let's say I run lft with which is a file manager they can run lots of different things that are not command prompts that run a specific language like bash or shell or zsh or anything like that so when you have problems I'm doing this video just so you know how to ask about them don't say funny things like oh how do I I don't know again copy and paste and bash scroll up and bash those are have nothing to do with bash anyway so hopefully you learn something if you're a noob or even if you're a veteran user who's been using words incorrectly for years and it's total cringe hopefully you learn something that's about it for today I will see you next time
Info
Channel: Luke Smith
Views: 177,064
Rating: undefined out of 5
Keywords: terminal, bash, shell, sh, zsh, fish, command, line, ubuntu, debian, arch, macos, iterm, gnome, xfce, copy, paste, PS1, customize, pipe, python, colors, color
Id: hMSByvFHOro
Channel Id: undefined
Length: 11min 6sec (666 seconds)
Published: Mon Dec 02 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.