• We had to restore from a backup today after a failed software update. Backup was from 0000 EDT and restored it at 0800 EDT so we lost about 8hrs. Today is 07/20/2024. More info here.

People who experimented with Konsole and tmux: what's so special about tmux for you?

Priest_Apostate

Active Member
Joined
Nov 7, 2023
Messages
121
Reaction score
29
Credits
1,406
Currently playing around with tmux (terminal multiplexer) on a Debian 12 and Rocky 9 system. I am trying to get the key combinations down pat - but I want to know: how is this supposed to be better than Konsole? Have you found tmux to be better? I ask because Konsole seems to have the same capabilities of being able to switch back and forth between the tabs - with the added benefit of not having to read through a 72 page man page to get one program to work (I mention this as I am studying Python, LPIC-1, and Terraform - in addition to work).

ETA: I am currently using https://tmuxcheatsheet.com/ to practice.
 
Last edited:


The advantage tmux is that you can create different tabs for different functions kind of like work-spaces and switch between them using key-binds. If you want you can open multiple windows within each tab and switch between them by using the horizontal split or vertical split. Lastly you can close your terminal, tmux will then detach itself, after which you can attach it again and you will still have all your tabs open. It's also possible to customize the key-binds if you have other keys that you find easier to use.
 
I use tmux for several reasons.

  1. Sometimes I need more than one terminal on a machine (single physical window, access multiple terminals)
  2. Sometimes I run a cli application and want to tail the log at the same time (split pane, single window)
  3. I have jump servers. (basically single ssh gateway to all other servers) I will ssh to the jump server and run tmux. Then with each extra termal, I can ssh to other servers and just CTRL+B # to whatever server I want to use at that moment. (though I usually reset tmux config to CTRL+A ala Screen since I was on screen before tmux)
  4. tmux allows me to start a long running job and disconnect from it and come back later and reattach to the same session to see the status or whatever else I may need.
Those are the primary reasons I use it.
 
oh btw. I actually use applications that support tabs also. (mRemoteNG, Konsole, etc) Though I still use tmux.

Remember, console apps that have tabs are local to your machine. They are not local to the remote machine. tmux is local to the remote machine. This is what makes detaching from a session so powerful. Konsole and mRemoteNG cannot do this.
 
I mostly use it to keep commands running on servers when the internet connection is bad or when I want to close the terminal due to the commend running for several hours. you can just detach from the tmux and it'll keep running in the background.

one famous usecase is restarting the network on a server - open tmux, then something like:

Code:
systemctl restart systemd-networkd.service
sleep 5
cp /etc/network/interfaces-old /etc/network/interfaces
systemctl restart systemd-networkd.service

if your new /etc/network/interfaces doesnt work it restores the old one. if it does work you can still type in the terminal during those 5 seconds ;)
 
I prefer Zellij, if anything. But in fact most of the time I just work with a new terminal-window if I want more than one.
 
oh btw. I actually use applications that support tabs also. (mRemoteNG, Konsole, etc) Though I still use tmux.

Remember, console apps that have tabs are local to your machine. They are not local to the remote machine. tmux is local to the remote machine. This is what makes detaching from a session so powerful. Konsole and mRemoteNG cannot do this.
I think this might have been the answer I was looking for as to why is tmux recommended - but I have another question: what does it mean to be "local to [my] machine", or "local to the remote machine?"
 
I think this might have been the answer I was looking for as to why is tmux recommended - but I have another question: what does it mean to be "local to [my] machine", or "local to the remote machine?"
You can install and use tmux on your local machine or you can have tmux installed on a remote machine and use it there.
 
I think this might have been the answer I was looking for as to why is tmux recommended - but I have another question: what does it mean to be "local to [my] machine", or "local to the remote machine?"

On your local machine. You can run tmux and have several terminals. You can also use Konsole to do this, but Konsole doesn't support split screen in a single terminal (two terminals in one window)

On a remote machine, you ssh to the remote machine and then run tmux. Now you have one connection to the server, but can turn around and create many terminals with that one ssh connection. (and disconnect while leaving your terminal running)
 
I setup tmux a long time ago and haven't looked at my configuration since then because it still works how I configured it some years back. Here's my configuration if you are interested.

Code:
#source theme
source-file "/etc/nixos/git/nixos/dotfiles/tmux-themepack/block/blue.tmuxtheme"

#unbind default prefix
unbind C-b

#bind new default prefix
set -g prefix C-a

#default delay time
set -s escape-time 1

#starting window and pane index
set -g base-index 1
setw -g pane-base-index 1

#disable auto window renaming
setw -g automatic-rename off
setw -g allow-rename off

#reload config file
bind r source-file ~/.tmux.conf \; display "Config Reloaded..."

#resend prefix to other apps, now press it twice in other apps.
bind C-a send-prefix

#bind splitting panes keys
bind | split-window -h
bind - split-window -v

#remap pane movement keys
bind i select-pane -U
bind k select-pane -D
bind j select-pane -R
bind l select-pane -L

#sync panes on/off
bind-key m set-window-option synchronize-panes\; display-message "synchronize-panes is now #{?pane_synchronized,on,off}"

#default terminal mode color
set -g default-terminal "screen-256color"

#history limit
set-option -g history-limit 10000
 
Do you have the ability to use that on remote systems?
I should try before I can answer that. In practice I use it very little. For me it is, like tux and similar systems, a solution looking for a problem most of the times
 
I setup tmux a long time ago and haven't looked at my configuration since then because it still works how I configured it some years back. Here's my configuration if you are interested.

Code:
#unbind default prefix
unbind C-b

#bind new default prefix
set -g prefix C-a
Clearly you used to be a screen user too. ;)

I can't stand ctrl+b, Screen's ctrl+a is so much more natural.
 
Clearly you used to be a screen user too. ;)

I can't stand ctrl+b, Screen's ctrl+a is so much more natural.
Agreed! Yes I used screen before I switched to tmux :)
 
Last edited:
I setup tmux a long time ago and haven't looked at my configuration since then because it still works how I configured it some years back. Here's my configuration if you are interested.
Thanks for that information! I will look it over, and try to experiment with it! The YT video I referenced was very helpful, as it demonstrated the key-presses via a virtual keyboard display. I personally thought this was a stroke of genius, as it cleared up up a LOT of confusion for me (while experimenting with the program, I worried that you had to be similarly equipped to an octopus in order to get the keypress combos correctly typed in)!
 

Members online


Latest posts

Top