Complete tmux Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys hackies floyd here back again with another video and in this video i'm going to be showing you how to get good with tmux because a lot of the feedback i received from the previous video that are actually covered how to use teamworks to a basic level uh were you know really requesting me to actually make a follow-up video where i cover everything you need to know to be competent or proficient with tmox and to get the job done so to say um so this video is going to be focused around that i'll be covering everything that i think is important and of course after that you will be in a point where you can actually use uh tmux comfortably but if you want to do anything else uh you can definitely check how to do that on your own this video is focused on the essentials all right so first of all i'm i'm going to talk about sessions all right so bear with me as i create our first session the first thing you want to do before you do anything else is if you're running this on parrot os or kali linux you need to make sure you have tmox installed so again you can use your aptitude package manager so sudo apt install and i'm going to tmux now i already have tmux installed so i really don't need to worry about that and for the for the duration of this video i'm going to be using a utility called screen key so that you guys can actually see what i'm going to be typing so i'll just disable that for now the first thing we want to do when we want to create a new session and i'm not going to give it a name or anything we just want to get into tmox because we type in tmox right and now that we're in tmox again you're going to get the highlighted green bar at the bottom that gives you all your open windows now in our case we only have uh one window which is a label from zero all the way to as many windows as you want that's something to take into consideration is that the window labeling starts from zero and moves on uh ford uh numerically uh you then have the the name of the window which you can actually assign and i'll get to that in a second and the asterisk actually specifies uh what window is selected so if you create more than one window you can actually move uh between them you know so that would make that a very good um indicator of what window you're on all right so the first thing i'm going to do is let me just enable a screen key and let's talk about new pains and how to create them and how to switch between pains so pains are slightly different right so if you have ever used something like terminator you know that you can split your terminal window into two sides into four sides as many sides or as many panes as you want and you can perform multiple tasks within those panes within the same window all right so it's not uh it's not quite the same as opening another window all right so the first thing we want to do to create a new pane we hit a control b and we use the percentage sign right or the percentage symbol right and of course that is done by invoking the shift key and as you can see that creates a new pane on to our right now if you want to switch between the pins we type in control b and we use the your navigational keys or your directional keys so now in my case if i wanted to move to the left i would use ctrl b and left if i wanted to move to the right so on and so forth you get the idea it's quite intuitive so again i can hit ctrl p and i want to go to the left and let's say i want to run h stop here i can run edge stop there if i want to go to the next one the next pane i can do that as well and i can do essentially all that i want here right so there's tons of stuff that i can you there's tons of stuff you can do within two panes and of course if you want to create a new one we can do that as well um so what i'm going to do is i'm going to say control b but instead of creating a third pane a third vertical pane to my right i'm going to create a uh pain on my bottom of the second pin right over here the one that's i'm currently active in here so what i'll do is let me just hit ctrl v and we're going to use the quotation mark and that creates a pain at the bottom as opposed to one on your right that stands vertically um so you can see you can create as many as you want so i can create another one at the bottom here and you get the idea it's fairly simple to understand what panes are so again if i want to exit i just hit exit in the ones that i want to close down so i can say exit and uh if i want to go to the next one i can get into that in it and then just hit um exit like so and that closes out the panes for me so that is creating pains it's very very simple use control and b and of course you then use the percentage sign or the percentage symbol to create a vertical pane and if you want to create a horizontal pane you use the quotation mark so that's control b and the quotation marks all right now if let's talk about windows all right so windows are you can think of them as entirely new windows where you can do whatever you want and you can sort them in regards to the task that you're trying to achieve in each of them right and in each of them you can create as many panes as you want so you really have a lot that you can do in terms of multitasking here so in in our case let's create a new window we do that by typing in control b and c and that creates a new window and as you can see uh the new window is going to be labeled after zero as one that makes logical sense right and it's going to have a name as bash and that's because we're currently in the bash shell and it's currently highlighted with the asterisk that means we are currently in window one now if i wanted to switch back into windows 0 i would type in control b and 0 all right and as you can see the asterisk is now selected here so just to show you how that works again if i run something like h top in windows 0 and i go to window 1 which is control b and 1 you can see we have nothing there but if i switch back to windows 0 we still have htop running so that it actually shows you that it's moving it's moving around as we expected all right so if we want to actually rename a particular window which is quite useful so let's say in this window i want to work with git i'm going to be doing all my commits and stuff from this particular window i would hit control b and then i would hit the the comma right over here and then i'll rename it to let's say git and i hit enter that's going to rename it there and if i wanted to rename the second window i'll just go into window one and i can hit a control b rename and let's say i'm going to be working with docker in the second window and i can just hit enter and now we have a bit of context as to what we're going to be using these windows for and of course within these windows we can create we can create panes and we can do multiple things within a single window so hopefully that makes sense um now if we want to actually exit from a window or close down a window all we need to do is type in exit right and that closes that window and as you can see right now we only have one window open which is the get window all right so that's fairly simple to understand now let's talk about sessions which is where the true power of tmark starts to shine through right so the reason i recommend dmacc so much especially for system administrators is because it handles uh it handles the terminals uh or the uh your processes in the form of sessions so uh when you start up tmux you start up a teamwork session and uh the the great thing about sessions is that it preserves your state or whatever process that's actually running within that window or within that session so if i was to lose connection to a server that i was connected to through ssh and i was using tmox and for whatever reason let's say i had a connection drop that means if i ssh back into that server and i reloaded or attached to my tmark session it would i would be exactly where i left it off and if i was running a process that process would not be terminated because i actually i lost the connection to that particular terminal instead it continues on in the background so that's the the great thing about it so uh to detach a session that you're working on uh you can do that by typing in control b and d and that will detach it as you can see now we're back into uh we're back into our normal terminal and you can see it is detached from session zero now when you have tmox running and you have team accessions running in the background you can view the sessions running in the background by typing in tmox ls and that tells you uh tmox0 by the way we can rename this session that's quite awesome as well and then it gives you a summary of how many windows you have open within that dmox session and when and when it was created so it gives you a bit of important context as to what you have running within that session so that's currently running in the background so if i want to reattach to that section to that particular session i'll just hit tmax and i'll say attach and i specify the target session and then the name of that session in this case the name is zero because we haven't specified it and i hit zero and it takes us into that session so let me just show you how this would work so let's say i want to type in git config and i say global and let's list my global configuration here all right so i've outputted some data and i just want to show you that it actually preserves the state so again control b and d to detach that and uh t marks ls you can see that that's currently running if again i specified t mux attached uh to the to session 0 you can see that the exact state is preserved so i hope that makes sense so i'm just gonna detach from that session and let's talk about um renaming sessions right so tmox ls you can see it's currently named as zero so if i want to rename this session i would type in tmox rename session and i'll specify uh the target which is going to be uh session zero and i'll provide the name here so i wanted to call it git i hit enter if i say tmox ls now you can see uh it actually tells us the session name is called get all right so let's say we wanted to only work with git within that session and we want to create a new session right but instead of going directly into that session we also want to give it a name before we go into the session so we say tmox and we say new we specify this is going to be a session and then we say uh let's say i want to work on docker in that session so now it's taken us into the docker session and again if we detach and we list the sessions that we have running you can now see we have git and the docker sessions all running concurrently running their own processes and we can switch between them as much as we want and again as i said uh these sessions will be preserved until the system reboots so that's something to keep into mind as well or to keep in mind as well all right so that's essentially how to use tmark sessions and you can create as many as you want let's talk about the final uh step which is actually deleting sessions or killing sessions that you're not using so if i say dmox i can say kill session and i specify the target which is going to in this case let's start let's start off with the docker session and i hit enter if i list this you can see it it actually killed the docker session and we can repeat this for the git session like so and there we are and if we list uh sorry about that if we list the currency mark sessions you can see we have none running so uh that was a comprehensive video on all the essentials that you will need to become competent uh and comfortable within tmox i haven't covered anything extensive about it but i'm sure depending on your own workflow uh you can customize tmux to your own liking and uh yeah so that's pretty much gonna that's gonna be it for this video guys let me know what you think i would love to hear your feedback in the comments section and i'll be seeing you in the next video peace guys
Info
Channel: HackerSploit
Views: 102,307
Rating: 4.9418497 out of 5
Keywords: hackersploit, hacker exploit, tmux configuration, tmux tutorial, tmux config, tmux vim, tmux mac, tmux vs screen, tmuxinator, tmux iterm2, tmux tutorial ubuntu, tmux tutorial youtube, tmux tutorial centos, tmux tutorial in hindi, tmux basics, tmux, vim, tmux vim setup, tmux for beginners, terminal, linux, linux tutorial for beginners, linux commands, hacking, kali linux
Id: Yl7NFenTgIo
Channel Id: undefined
Length: 12min 7sec (727 seconds)
Published: Wed Apr 08 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.