• Contact
  • Contact Us
  • Disclamer
  • Home 1
  • Home 2
  • Home 3
  • Privacy Policy
Sunday, May 25, 2025
How VPS - How to use/setup VPS
  • Login
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
How VPS - How to use/setup VPS
No Result
View All Result
Home Operating System CentOS

Boost Productivity with Tmux on Ubuntu and CentOS

How VPS by How VPS
October 1, 2019
in CentOS
0
0
SHARES
42
VIEWS
Share on FacebookShare on Twitter

Contents

  1. Introduction
  2. Installation
  3. Terminology
  4. Usage
    1. Start a new tmux session
    2. Maneuvering in tmux
    3. Create Multiple Panes
    4. Create Multiple Windows
    5. Attach and Detach to/from a Session
  5. Conclusion
    1. Some Useful Commands
      1. Common key bindings
      2. Common session commands
  6. Want to contribute?


Introduction

Tmux is a terminal multiplexer. It allows you to run and manage several command prompts simultaneously from one tmux session. It is the equivalent of a graphical window manager, for command prompts.

Tmux uses a client/server model which allows it to persist connections. This means that you can start a session from one computer (say your work computer), have several programs running on it, leave work and connect back to the same session from a different computer (say your home computer). When reconnecting to your session, you will continue where you left – the same programs will be running.

Installation

On Debian/Ubuntu systems use:

sudo apt-get update && sudo apt-get -y install tmux

On Redhat/CentOS systems use:

sudo yum install update && sudo yum -y install tmux

Note: “-y” in both cases above auto answers “yes” during installs. Above commands were tested on Ubuntu 12 & 14 and CentOS 6 & 7.

Terminology

Pane – A pane is simply a terminal prompt.
Window – A window holds multiple panes (terminals) on one screen.
Session – A session has multiple windows. Sessions are similar to applications that create virtual/multiple desktop workspaces like GNOME on Linux and VirtualWin on Windows.

Usage

Start a new tmux session

tmux new -s start

You will see a bar at the bottom of the screen with the session name “start” in brackets. What just happened, was that tmux started a new session named “start” that contained a default window holding one pane (terminal). Upon creating a pane, tmux automatically logs you in with your user account.

Maneuvering in tmux

Once inside a tmux session, you use a prefix key to trigger commands to tell tmux what to do. The default prefix key is CTRL + b. For example, if you want to tell tmux to create a new pane by splitting your screen into two vertical sections, you first hit CTRL + b, then %.

Create Multiple Panes

If you already keyed in CTRL + b, then % above, then you will see that you already have two panes on your screen.

Split the current pane into two horizontal sections by keying CTRL + b, then “.

To rotate/cycle through all three panes use CTRL + b, then o.

Create Multiple Windows

Lets create a new window inside of the same “start” session that we are already in. Hit CTRL + b, then c. You will see a new blank terminal.

Split this terminal into two horizontal panes – CTRL + b, then “.

Create a third window CTRL + b, then c. You will see a new blank terminal again. Issue the command tmux list-windows, then press ENTER to confirm that you have 3 windows opened.

Use CTRL + b, then n to cycle between the three windows created.

Attach and Detach to/from a Session

Use CTRL + b, then d to detach from your current session (this should be the “start” session created earlier).

Reconnect back to start session using tmux attach -t start. Use CTRL + b, then n to cycle between the three windows in start session.

When at another location (or on a different machine), SSH into your server. After logging in, issue the tmux attach -t start command. You will see that it connects you to the start session with all three windows running intact.

Conclusion

As already stated, tmux is the equivalent of a graphical windows manager, but for command prompts. It is sure to boost your productivity significantly, and is comparable to tabs for browsers.

You can take things further by using configuration tools for tmux like teamocil and tmuxifier to define better workflows.

Some Useful Commands

Common key bindings

CTRL + b, then c – Create new window.
CTRL + b, then , – Rename window.
CTRL + b, then n – Move to the next window.
CTRL + b, then p – Move to the previous window.
CTRL + b, then & – Kill current window.
CTRL + b, then % – Split current pane into two (vertically).
CTRL + b, then “ – Split current pane into two (horizontally).
CTRL + b, then o – Switch to next pane.
CTRL + b, then q – Show pane numbers (then type a # to switch to it).
CTRL + b, then d – Detach from current session.
CTRL + b, then ? – List all key bindings.

Common session commands

tmux list-sessions – List existing tmux sessions.
tmux new -s session-name – Create a new tmux session named session-name.
tmux attach -t session-name – Connect to an existing tmux session named session-name.
tmux switch -t session-name – Switches to an existing tmux session named session-name.

Written by Lami Adabonyan

Want to contribute?

You could earn up to $300 by adding new articles

Submit your article
Suggest an update
Request an article
Previous Post

How to Install MoinMoin on CentOS 7

Next Post

How to Install Jupyter Notebook on a Vultr CentOS 7 Server Instance

Next Post

How to Install Jupyter Notebook on a Vultr CentOS 7 Server Instance

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

No Result
View All Result

Recent Post

Install Imagemagick on CentOS
CentOS

Install Imagemagick on CentOS

by How VPS
June 28, 2023
0

This is how I installed Imagemagick on a vanilla CentOS server Start off by installing the prerequisites yum install php-pear...

Read more
how to Check phpinfo

How to Check phpinfo of Hosting or VPS?

June 28, 2023
Failed to download metadata for repo 'appstream' on Centos 8

How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

February 25, 2022
How to Fix MySQL Error "Plugin 'InnoDB' registration as a STORAGE ENGINE failed"?

How to Fix MySQL Error “Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed”?

November 17, 2020
How to optimize Mysql or MariaDB

How to optimize Mysql or MariaDB

November 3, 2020

Recent News

  • Install Imagemagick on CentOS
  • How to Check phpinfo of Hosting or VPS?
  • How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

Category

  • Arch
  • Authentication
  • Backups
  • BSD
  • Centmin Mod
  • CentOS
  • Control Panels
  • CoreOS
  • CWP
  • Debian
  • Directadmin
  • Encryption
  • Fedora
  • Firewalls
  • Hocvps Script
  • Hosting providers
  • Kloxo-MR
  • Linux
  • Mitigations
  • Operating System
  • Plesk
  • Reviews
  • Securing VPS/Servers
  • Security Patches
  • SSL Certificates
  • Uncategorized
  • Upgrading
  • VPS/Servers management guides
  • Vulnerability Detection
  • Web servers software
  • Webhosting Control Panel
  • About
  • Advertise
  • Careers
  • Contact

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
Thabet