Friday, January 18, 2019

TMUX (part-2) Installation and Basics

In the last Article (tmux-Terminal Multiplexer Intro - Part-1), we just discussed what is tmux, comparison with terminals and how this can be helpful in our day to day activities.

Today, lets discuss about the Installation and some basics stuff about the tmux.

Installation-

So, if you are using mac then install tmux as below:
              $ brew install tmux 

If using ubuntu then you can install using "apt-get" as below:
              $ sudo apt-get install -y tmux 

To verify, if the installation is completed successfully by checking the version-
              $ tmux -V
              tmux 2.6

If you want then you can also do the installation using the source code.

Starting tmux:

Start tmux just typing using command "tmux":
              $ tmux 
So when you will just hit enter, you'll notice that you will be get landed to another window as show in below screen shot. Yes, you are right, so that will be your workspace where you are going to work. You can do everything here, as you do with your normal terminals.

Fig-1 tmux terminal(See at the bottom the red highlighted)

To exit this, just type "exit" command and then you will be back to your standard terminal.

Another thing to notice, if you doing stuff for just a short period, then maybe this is not the best way to work with tmux sessions. Instead, We can create "named sessions", that we can then use later on.

Create Named Sessions:

On a single terminal, we can create multiple sessions by giving them a particular name and then organize them as needed. Now, using below command, I'll create 2 sessions with name "Dev" and "Test". 
              $ tmux new-session -s Dev
              $ tmux new-session -s Test

For now it may be doesn't seem useful. But what we you want to execute some long running process e.g. any monitoring process or any long DB query and don't want to scare the screen all the time. In these kind of situation, you can take help on tmux feature which helps us to run jobs in background and help us to catch the things latter on. Let's see how we can do this.

Detaching and Attaching the Sessions:

Now, lets see how we can detach and then later attach to the same screen. Now, I have two sessions "Dev" and "Test". I am going to run "top" command in "Dev" and monitor the partition in another "Test" Session.



Now, we can detach from both sessions using the combination of PREFIX(Ctrl+b) followed by "d". In below screenshot, I have detached both sessions and now back to the standard terminal.
On the standard terminal, you list down the active sessions as well.


 Reattaching to Existing Sessions:

Now, you know to detach from the session and run the stuff in the background. On the next day lets support if want to see whats going on inside these sessions, then you have flexibility yo reattach to these as shown below:

              $ tmux attach -t Dev
              $ tmux attach -t Test



That's all for now. Please try your self and check if this can be useful for you.

Kubernetes 1.31 || Testing the Image Volume mount feature using Minikube

With Kubernetes new version 1.31 ( https://kubernetes.io/blog/2024/08/13/kubernetes-v1-31-release/ ) there are so many features releases for...