Learn tmux (Part 1) Boost your Linux Productivity with this 5-part Course!

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] thank you hello again everyone and welcome back to learn Linux TV and also welcome to my brand new updated tmux series here on learn Linux TV in this series I'm going to teach you everything that you need to know to get up and running with tmux I'm going to take you right from the beginning I'm going to show you all of the core features and I'll even show you how to configure team up to make it your own by the end of the series now the thing is I've already done a tmux series on this channel and if you've already watched it then there's nothing new to learn here every now and then I decide to modernize or improve or update my tutorial series here on the channel to make sure that we have a consistent level of quality and it's been quite a while since the most recent version of this Series has come out and a lot has changed on the channel since then and every video in this course is being uploaded all at the same time so every episode is available right now in fact you could get every episode here on YouTube for the low low price of absolutely free so if you're a fan of free courses then definitely click that like button and also subscribe to learn Linux TV because there's a lot more where this can came from anyway what I'm going to do in this video is go over what tmux is and the goal that it helps you solve why you might want to consider using it in the first place and then we'll go from there and start learning tmux in the next section I'll show off some of its features we'll also install it as we go through the video it's going to be a lot of fun so let's Dive In so what is tmux and why should you care about it well you're seeing tmux in front of you right now and at first it might not look like all that much but with tmux your workflow can go from this to this but what exactly is it well tmux is what's known as a terminal multiplexer a multiplexer essentially allows you to have terminals inside of terminals of course that's an overly simplified explanation but it's good enough for this series in order to use tmux all you have to do is type tmux and then press enter once you do that you are using tmux now at first it doesn't look all that different but one thing that absolutely stands out is that green bar there at the bottom of the window that's one way that you can know that you're using tmux because there's a footer down there and I'll be explaining everything in that footer later in the series so don't worry so much about that but what you're seeing is tmux without any customization at all whatsoever once activated tmux itself becomes what you are primarily working with within your terminal session you can still enter in all the same Linux commands that you normally would there's no difference when it comes to that but with tmux your session stays persistent so even if your internet connection drops while connected to a remote server for example any tasks that you might have had running will stay running if you are running those tasks within tmux in addition you'll also benefit from cool additional features like session management tabs splits and so on now I want to underscore the fact that tmux will keep your session active in the background even if your SSH connection for example drops now that's something that a lot of us Linux administrators are afraid of a situation where we're doing something really important maybe installing a package and then our connection drops in the middle of the installation that could cause file system damage half installed applications things like that definitely something that we wouldn't want to experience so by running everything within tmux then you are protected from that particular scenario so let's take a look at activating tmux in our shell session here to see how we can start using it the first thing that we'll need to do is make sure that tmux is installed and one way that we could do that is type command Dash V and then tmux just like that when I press enter if I see output then tmux is installed if I don't well then tmux clearly needs to be installed and you'll have to use your distributions package manager to install the tmux package and that's fairly easy to do if you're running on Debian like I am or Ubuntu or any distribution that's based on Ubuntu or Debian then all you should have to do is run sudo apt update and then I'll run sudo apt install and then tmux just like that it's a small program so it doesn't take all that long to install but now we have tmux on the system and if you didn't already have output when you ran command Dash V and then tmux you should see something like user bin tmux which will let you know that tmux is on the system and if you're not running Debian like I am or Ubuntu for that matter then just modify the commands accordingly for example if you are running on Fedora or something that's based on Fedora sentos Red Hat Enterprise Linux or similar distributions what you could do is run sudo dnf install and then tmux just like that for those of you that are running on Arch Linux then your command will be sudo Pac-Man Dash capital S tmux just like that if you're using a different distribution you can modify the commands accordingly all you have to do is make sure that you have the tmux package installed to use tmux like I mentioned earlier we can simply type tmux and then press enter we should see the footer bar there at the bottom which is our indicator that we're currently using tmux next what I'll have you do is run a command here in tmux I don't care which command you run you can run whatever command you want you can run something simple like LS for example that's fair if you have h-top installed I have it installed in my end then you can run that if that's what you want to do it doesn't matter what command you run just run any Linux command here in the window now what I'm going to do is send the prefix key this is something that we'll be going over in detail in this series so it's okay if it doesn't make complete sense right now just follow along and it'll make sense soon so to send the prefix Key by default you'll hold Ctrl and press letter b after you do that you release both keys and then press D on your keyboard which will detach you from your session at this point we are no longer using tmux the footer Bar is missing we are back to our normal shell session it even says right there detached from session zero so well we have detached from tmux we're no longer using it however our team up session didn't disappear it didn't go away and to prove that I could run tmux and then list hyphen sessions just like that and it shows me that I have a session running right there so even though I disconnected or detached from that session and everything that was running inside of it is still running in the background even if this was an SSH connection and I completely log out the session will still be there running as long as I don't close the session or reboot the server then it'll stay persistent if I want to reattach to the session then what I could do is run tmux and then attach just like that and check it out h-top in my case is running just like nothing ever happened and honestly nothing did happen when I detached from a session then h-top continued to run inside of the session even though I wasn't connected to it now again what we've done is we activated tmux we ran a command inside of tmux and then we detached from tmux to do basically anything in tmux you first send the prefix Key by default that's control and B you hold Ctrl and press B once you do that you give tmux a command or some sort of instruction by setting the prefix key you're telling tmux that what you are about to do should be at the attention of tmux itself and not the underlying shell so since I've sent the prefix key I then only need to send whatever command I want and detach is just D on the keyboard now when we ran tmux attached just like that we told tmux that we don't want it to start a new session if we ran tmux by itself it would create a new session but I didn't want to do that I wanted to attach to an existing session which is exactly what that command allows us to do it'll reattach me to the most recent session that I was currently using as of the time I disconnected when I press enter that's exactly what happened since this session right here was the one that I was working with it brought me right back to that particular session but I think I'm going to close this particular episode right here I just wanted to show you how to install tmux how to open it how to detach from it and also how to reattach to your session and we learned all of that in this video now the next video we'll get into splits but before you go on to the next video I just want you to practice sending the prefix key again Ctrl B hold Ctrl and press B by default that gets tmux's attention and then for example you could press D to disconnect I'll be giving you additional tmux commands throughout the series but that's your first one for now just make sure you remember everything that I taught you so far and then you should be good to go now hopefully you're enjoying this series so far but I need to stop the video right here I don't want to overwhelm you guys so just make sure that you understand everything that I've gone over so far and when you're ready you can move on to the next video which like I mentioned at the beginning of this video is already uploaded anyway thanks so much for watching I really appreciate it and I'll see you in the next episode as soon as you're ready thank you [Music] [Music] foreign [Music]
Info
Channel: Learn Linux TV
Views: 101,087
Rating: undefined out of 5
Keywords: Linux, gnu/linux, LearnLinuxTV, Learn Linux TV, LearnLinux.TV, Learn Linux, Linux Training, Linux Tutorials, tmux, tmux tutorial, tmux guide, getting started with tmux, learn tmux, tmux tutorial for beginners, tmux tutorial linux, tmux tutorial youtube, tmux tutorial ubuntu, tmux basics, terminal (software), tmux for beginners, terminal multiplexer, tmux configuration, tmux config, tmux settings, tmux plugins
Id: UxbiDtEXuxg
Channel Id: undefined
Length: 9min 46sec (586 seconds)
Published: Sat Aug 19 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.