• Domains
  • Web Hosting
  • WordPress Hosting
  • Reseller Hosting
  • Cloud VPS
  • Dedicated Servers
  • Domains
  • Web Hosting
  • WordPress Hosting
  • Reseller Hosting
  • Cloud VPS
  • Dedicated Servers
home/Knowledge Base/Dedicated Servers/Ubuntu/Boost Productivity with Tmux on Ubuntu and CentOS
Popular Search:Dedicated Server, CentOS, Web Hosting

Boost Productivity with Tmux on Ubuntu and CentOS

21 views 0 December 6, 2019 Updated on December 14, 2019 aklwebhost

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 & 16 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.

Tags:Boost Productivity with Tmux on Ubuntu and CentOS

Was this helpful?

Yes  No
Related Articles
  • Setup Spigot Server on Arch Linux
  • How To Install OSSEC HIDS on a CentOS 7 Server
  • Initial Setup of a CentOS 7 Server
  • Using StrongSwan for IPSec VPN on CentOS 7
  • Hot Backups with Percona XtraBackup on the One-Click WordPress App
  • Installing Rust on Ubuntu 14.04
Leave A Comment Cancel reply

Ubuntu
  • Boost Productivity with Tmux on Ubuntu and CentOS
  • Installing Rust on Ubuntu 14.04
  • Using Tango on Ubuntu 14.04
  • Setup Spigot on Ubuntu
  • Setup Fail2ban Ubuntu x64
  • Installing InfluxDB on Ubuntu 14
View All 96  
Popular Articles
  • Using StrongSwan for IPSec VPN on CentOS 7
  • Disabling SSDP (Linux / Windows)
  • Can I pay by Western Union?
  • Can a Coupon Code Discount Be Carried Forward While I Upgrade My VPS Account
  • Can I pay multiple due invoices using a single transaction?
KB Categories
  • Billing
  • Cloud Hosting
  • CMS Hosting
  • cPanel/WHM Control Panel Guide
  • Dedicated Servers
    • AMD Opteron 6272
    • Arch
    • Backup Storage
    • Bandwidth
    • Basic Security
    • BSD
    • CentOS
    • Containers
    • CoreOS
    • DDoS Protection
    • Debian
    • Dedicated Server Control Panel
    • Intel Core i5 3550
    • Intel Core i5 4570
    • Intel Core i7 3770
    • Intel Core i7 4770
    • Intel Xeon E3 1230 V3
    • Intel Xeon E3 1245 V2
    • IP Space
    • Linux Guides
    • Minecraft
    • Networking
    • Server Apps
    • Server Troubleshooting
    • Ubuntu
    • Windows Guides
    • Windows Server 2008
    • Windows Server 2012
  • Domain Names
  • Email Support Documentation
    • Setup IMAP or POP
    • User Features – How To
    • Webmail – How To
  • FTP (File Transfer Protocol
    • CuteFTP Guide
    • FileZilla Guide
  • Game Servers
  • MySQL and MariaDB
  • Node.js
  • Plesk Web Hosting Guide
  • VPS Server
  • Web Servers

  Better Monitoring Tools For Ubuntu And CentOS

Boost Productivity with Z and Zsh on CentOS  

  • Privacy Policy
  • Terms of Use
  • © 2022 AKLWEB HOST LLC, All Rights Reserved.

Popular Search:Dedicated Server, CentOS, Web Hosting