{"id":15836,"date":"2019-03-06T11:53:20","date_gmt":"2019-03-06T11:53:20","guid":{"rendered":"https:\/\/www.hostinger.com\/tutorials\/?p=15836"},"modified":"2026-03-10T09:30:45","modified_gmt":"2026-03-10T09:30:45","slug":"how-to-use-tmux","status":"publish","type":"post","link":"\/ca\/tutorials\/how-to-use-tmux\/","title":{"rendered":"How to use tmux for terminal multitasking"},"content":{"rendered":"<p>A terminal multiplexer, or tmux, is <strong>a command-line tool that lets you manage multiple terminal sessions in a single window<\/strong>. With tmux, you can split panes, create multiple windows, and keep sessions active in the background.<\/p><p>The primary benefit of tmux is persistence. If your SSH connection drops or you accidentally close your terminal emulator, the processes running inside tmux continue on the server. You can reconnect and resume work exactly where you left off.<\/p><p>The essential steps to mastering tmux include:<\/p><ul class=\"wp-block-list\">\n<li><strong>Installation<\/strong>. Set up tmux on your Linux system and verify the installed version.<\/li>\n\n\n\n<li><strong>Session management<\/strong>. Start named sessions, detach without stopping processes, and reattach later.<\/li>\n\n\n\n<li><strong>Window organization<\/strong>. Create, rename, and navigate multiple windows to keep tasks separate.<\/li>\n\n\n\n<li><strong>Pane control<\/strong>. Split a single window into multiple visible sections for simultaneous monitoring.<\/li>\n\n\n\n<li><strong>Customization<\/strong>. Modify keybindings and behavior through the <strong>.tmux.conf<\/strong> file.<\/li>\n<\/ul><p>\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-how-to-use-tmux\"><strong>How to use tmux<\/strong><\/h2><p>To use tmux, <strong>first install the utility on your server, then start a session using the tmux command<\/strong>.<\/p><p>Once inside a session, you use a specific prefix key (<strong>Ctrl + B<\/strong> by default) combined with other keys to perform actions such as splitting the screen or creating new windows.<\/p><p>When you finish working but want to keep processes running, you detach from the session. tmux keeps it active in the background until you attach to it again later.<\/p><h3 class=\"wp-block-heading\"><strong>Install tmux<\/strong><\/h3><p>Most Linux distributions do not include tmux by default, so you usually need to install it manually. You need superuser or root privileges to install packages.<\/p><ol class=\"wp-block-list\">\n<li>Log in to your remote system using an SSH client such as <a href=\"\/ca\/tutorials\/how-to-use-putty-ssh\/\">PuTTY<\/a> or your local terminal. Hostinger VPS users can find their login credentials in the <strong>VPS Overview<\/strong> section of hPanel.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"6a58f04c7c794\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a58f04c7c794\" class=\"aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/62\/2025\/12\/how-to-migrate-google-my-business-website-1.png\/w=1024,h=1024,fit=scale-down\" alt=\"hPanel VPS overview highlighting root access login credentials\" class=\"wp-image-137633\"  sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><ol start=\"2\" class=\"wp-block-list\">\n<li>Before installing tmux, update your system&rsquo;s package repository to make sure you download the latest stable version. Run one of the following commands, depending on your distribution:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo apt update        # Debian and Ubuntu<\/pre><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo dnf makecache     # RHEL, CentOS, and Fedora<\/pre><ol start=\"3\" class=\"wp-block-list\">\n<li>Once the update completes, run the appropriate installation command:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo apt install tmux  # Debian and Ubuntu<\/pre><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo yum install tmux  # RHEL and CentOS<\/pre><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo dnf install tmux  # Fedora<\/pre><ol start=\"4\" class=\"wp-block-list\">\n<li>After the installation finishes, confirm that tmux is installed by checking the version:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">tmux -V<\/pre><p>If the terminal returns a version number, such as tmux 3.4 or later, the installation succeeded. If you see a &ldquo;command not found&rdquo; error, verify your PATH or try reinstalling tmux.<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"6a58f04c7e69e\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a58f04c7e69e\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/terminal-tmux-v-1.png\/w=1024,h=1024,fit=scale-down\" alt=\"Terminal output showing the tmux version command result\" class=\"wp-image-137634\"><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><figure class=\"wp-block-image size-large\"><a class=\"hgr-tutorials-cta hgr-tutorials-cta-vps-hosting\" href=\"\/ca\/vps-hosting\" target=\"_blank\" rel=\"noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"300\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner.png\/w=1024,h=1024,fit=scale-down\" alt=\"\" class=\"wp-image-77934\"  sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><h3 class=\"wp-block-heading\"><strong>Start a new session<\/strong><\/h3><p>You can start a tmux session by typing <strong>tmux<\/strong> in your main terminal window. By default, tmux assigns each session a numeric ID starting at <strong>0<\/strong>.<\/p><p>This approach works for quick tasks but becomes hard to manage when you run multiple sessions at the same time.<\/p><p>We recommend starting each session with a custom name. When you run <strong>tmux ls<\/strong> to list sessions, numeric IDs such as <strong>0<\/strong>, <strong>1<\/strong>, or <strong>2<\/strong> provide little context. Descriptive names like <strong>backend-deployment<\/strong> or <strong>server-logs<\/strong> make each session&rsquo;s purpose clear at a glance.<\/p><p>To start a named session, use the <strong>-s<\/strong> flag followed by your chosen name:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">tmux new -s session-name<\/pre><p>After you run this command, tmux clears the terminal and displays a status bar at the bottom of the screen. By default, the bar appears green, but you can customize it.<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"6a58f04c81284\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a58f04c81284\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/terminal-tmux-session-scaled.png\/w=1024,h=1024,fit=scale-down\" alt=\"Active tmux session displayed inside a terminal window\" class=\"wp-image-137635\"><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>The status bar confirms that you are inside a tmux session. It shows the current shell (usually <strong>bash<\/strong> or <strong>zsh<\/strong>), the session name, and the current time.<\/p><h3 class=\"wp-block-heading\"><strong>Detach and attach sessions<\/strong><\/h3><p>One of tmux&rsquo;s most important features is the ability to detach from a session. Detaching sends the session to the background and keeps all running programs active, while returning you to the main shell prompt.<\/p><p>This feature helps when you run long processes, such as database migrations, and need to disconnect your SSH client, or when your internet connection is unstable.<\/p><p>If the connection drops unexpectedly, tmux detaches the session instead of terminating it.<\/p><p>To detach from a session, press the prefix key <strong>Ctrl + B<\/strong>, release both keys, then immediately press <strong>D<\/strong>. The terminal will display a <strong>[detached]<\/strong> message.<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"6a58f04c81d34\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a58f04c81d34\" class=\"aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"596\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/62\/2025\/12\/WordPress-alt-1-1.jpg\/w=1024,h=1024,fit=scale-down\" alt=\"Terminal showing tmux session detached status highlighted\" class=\"wp-image-137636\"  sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>To resume work, reattach to the session. If only one session is running, use:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">tmux attach<\/pre><p>If multiple sessions are active, specify the target session with the <strong>-t<\/strong> flag:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">tmux attach -t session-name<\/pre><p>You can also use a numeric session ID if you did not name the session, for example, <strong>tmux attach -t 0<\/strong>. But descriptive names are easier to remember than numbers.<\/p><h3 class=\"wp-block-heading\"><strong>Manage sessions<\/strong><\/h3><p>Effective session management prevents your server from filling up with unused background processes or &ldquo;zombie&rdquo; sessions. Check active sessions regularly to stay organized.<\/p><p>To list all active tmux sessions, run the following command in your main terminal:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">tmux ls<\/pre><p>The output includes the following details:<\/p><ul class=\"wp-block-list\">\n<li><strong>Session name<\/strong>. The identifier you assigned or the default numeric ID.<\/li>\n\n\n\n<li><strong>Windows<\/strong>. The number of open windows in the session.<\/li>\n\n\n\n<li><strong>Created<\/strong>. The date and time when the session started.<\/li>\n\n\n\n<li><strong>Attached<\/strong>. Whether the session is currently in use.<\/li>\n<\/ul><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"6a58f04c82ff3\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a58f04c82ff3\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/terminal-tmux-ls-scaled.png\/w=1024,h=1024,fit=scale-down\" alt=\"Terminal output listing active tmux sessions with tmux ls\" class=\"wp-image-137637\"><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>If you are currently inside a tmux session, you can switch to another one using the following command. As with reattaching, specify the session name or ID:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">tmux switch -t session-name<\/pre><p>When you finish a task and no longer need the background processes, kill the session to free system resources.<\/p><p>To terminate the current session, type <strong>exit<\/strong> or press <strong>Ctrl + D<\/strong>. To kill a specific session without attaching to it, use the kill-session command:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">tmux kill-session -t session-name<\/pre><p>    <div class=\"announcement-block announcement-block--warning\">\n        <span class=\"announcement-block__heading\">\n            <svg width=\"24\" height=\"26\" viewBox=\"0 0 24 26\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                <path fill-rule=\"evenodd\" clip-rule=\"evenodd\"\n                d=\"M12 23.5C17.799 23.5 22.5 18.799 22.5 13C22.5 7.20101 17.799 2.5 12 2.5C6.20101 2.5 1.5 7.20101 1.5 13C1.5 18.799 6.20101 23.5 12 23.5ZM13.637 8.65198C13.637 7.74791 12.9041 7.01501 12 7.01501C11.0959 7.01501 10.363 7.74791 10.363 8.65198C10.5335 10.5375 10.875 14.383 10.875 14.383C10.875 15.0043 11.3787 15.508 12 15.508C12.6213 15.508 13.125 15.0043 13.125 14.383V14.38L13.637 8.65198ZM11.9927 16.714C11.3714 16.714 10.8677 17.2177 10.8677 17.839C10.8677 18.4603 11.3714 18.964 11.9927 18.964H12.0073C12.6286 18.964 13.1323 18.4603 13.1323 17.839C13.1323 17.2177 12.6286 16.714 12.0073 16.714H11.9927Z\"\n                fill=\"#BE1025\"\/>\n            <\/svg>\n            Warning        <\/span>\n        <p class=\"announcement-block__content\">\n            <strong>Warning!<\/strong> Use <strong>kill-session<\/strong> with caution. This command immediately stops all processes running in the session. If you have unsaved data in a text editor or an active database operation, you will lose it permanently.        <\/p>\n    <\/div>\n\n    \n\n\n\n<\/p><h3 class=\"wp-block-heading\"><strong>Create and navigate windows<\/strong><\/h3><p>A single tmux session can contain multiple windows, similar to tabs in a web browser or a GUI terminal application. This setup lets you keep different contexts separate within the same project without starting a new session.<\/p><p>For example, a typical workflow might include:<\/p><ul class=\"wp-block-list\">\n<li><strong>Window 0 (editor)<\/strong>. Running a text editor such as <strong>vim<\/strong> or <a href=\"\/ca\/tutorials\/how-to-install-and-use-nano-text-editor\/\">nano<\/a>.<\/li>\n\n\n\n<li><strong>Window 1 (server)<\/strong>. Running the web server or application.<\/li>\n\n\n\n<li><strong>Window 2 (git)<\/strong>. Executing <a href=\"\/ca\/tutorials\/basic-git-commands\/\">Git commands<\/a>.<\/li>\n<\/ul><p>To create a new window, press <strong>Ctrl + B &rarr; C<\/strong>. The new window appears in the status bar at the bottom of the screen, marked with a new number and an asterisk (<strong>*<\/strong>) to indicate that it is active.<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"6a58f04c844ca\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a58f04c844ca\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/terminal-tmux-session-window-number-asterisk-highlighted-scaled.png\/w=1024,h=1024,fit=scale-down\" alt=\"tmux window number with active asterisk highlighted in status bar\" class=\"wp-image-137638\"><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>To navigate between windows:<\/p><ul class=\"wp-block-list\">\n<li><strong>Next window<\/strong>. Press <strong>Ctrl + B &rarr; N<\/strong>.<\/li>\n\n\n\n<li><strong>Previous window<\/strong>. Press <strong>Ctrl + B &rarr; P<\/strong>.<\/li>\n\n\n\n<li><strong>Jump to a specific window<\/strong>. Press <strong>Ctrl + B<\/strong>, then a number key from <strong>0&ndash;9<\/strong> that matches the window ID.<\/li>\n<\/ul><h3 class=\"wp-block-heading\"><strong>Rename and organize windows<\/strong><\/h3><p>By default, tmux names each new window after the active process, usually <strong>bash<\/strong>, <strong>sh<\/strong>, or <strong>zsh<\/strong>.<\/p><p>In a complex session with several windows, names like &ldquo;bash&rdquo; make it hard to tell which window contains logs and which one holds your editor.<\/p><p>Rename windows to reflect their purpose and make navigation easier:<\/p><ol class=\"wp-block-list\">\n<li>Navigate to the window you want to rename.<\/li>\n\n\n\n<li>Press <strong>Ctrl + B &rarr; ,<\/strong> (comma).<\/li>\n\n\n\n<li>The status bar changes color and prompts you to edit the name.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"6a58f04c85937\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a58f04c85937\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/terminal-tmux-window-rename-window-highlighted-scaled.png\/w=1024,h=1024,fit=scale-down\" alt=\"tmux status bar showing window rename prompt highlighted\" class=\"wp-image-137639\"><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><ol start=\"4\" class=\"wp-block-list\">\n<li>Delete the existing name, type a new one &ndash; for example, <strong>database<\/strong> &ndash; and press <strong>Enter<\/strong>.<\/li>\n<\/ol><p>The updated name appears immediately in the status bar, making window navigation faster.<\/p><h3 class=\"wp-block-heading\"><strong>Split windows into panes<\/strong><\/h3><p>Windows work well for separating distinct tasks, while panes let you divide a single window into multiple visible sections. This setup is ideal for multitasking when you need to cross-reference information.<\/p><p>For example, you might view real-time server error logs on the left side of the screen while triggering those errors by running commands on the right.<\/p><p>Use the following keybindings to split the current pane:<\/p><ul class=\"wp-block-list\">\n<li><strong>Split into left and right panes<\/strong>. Press <strong>Ctrl + B &rarr; Shift + 5<\/strong> (the <strong>%<\/strong> key).<\/li>\n\n\n\n<li><strong>Split into top and bottom panes<\/strong>. Press <strong>Ctrl + B &rarr; Shift + &lsquo;<\/strong> (the <strong>&ldquo;<\/strong> key).<\/li>\n<\/ul><p>You can combine these commands to build complex layouts. For example, split the window left and right first, then split the right pane into top and bottom sections.<\/p><p>This creates one large pane on the left and two smaller panes on the right.<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"6a58f04c86307\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a58f04c86307\" class=\"aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"596\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/62\/2025\/12\/10-Best-Website-Design-Inspiration-Sources-to-Get-You-Started.png\/w=1024,h=1024,fit=scale-down\" alt=\"tmux window split into multiple panes in a terminal\" class=\"wp-image-137640\"  sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p><div class=\"announcement-block announcement-block--important\">\n            <span class=\"announcement-block__heading\">\n                <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                    <path fill-rule=\"evenodd\" clip-rule=\"evenodd\"\n                          d=\"M12 22.5C17.799 22.5 22.5 17.799 22.5 12C22.5 6.20101 17.799 1.5 12 1.5C6.20101 1.5 1.5 6.20101 1.5 12C1.5 17.799 6.20101 22.5 12 22.5ZM13.637 7.65198C13.637 6.74791 12.9041 6.01501 12 6.01501C11.0959 6.01501 10.363 6.74791 10.363 7.65198C10.5335 9.53749 10.875 13.383 10.875 13.383C10.875 14.0043 11.3787 14.508 12 14.508C12.6213 14.508 13.125 14.0043 13.125 13.383V13.38L13.637 7.65198ZM11.9927 15.714C11.3714 15.714 10.8677 16.2177 10.8677 16.839C10.8677 17.4603 11.3714 17.964 11.9927 17.964H12.0073C12.6286 17.964 13.1323 17.4603 13.1323 16.839C13.1323 16.2177 12.6286 15.714 12.0073 15.714H11.9927Z\"\n                          fill=\"#FEA419\"\/>\n                <\/svg>\n                Important\n            <\/span>\n            <p class=\"announcement-block__content\">\n                <strong>Important!<\/strong> tmux terminology can be counterintuitive. The <strong>%<\/strong> key creates a vertical divider, resulting in side-by-side panes. Meanwhile, <strong>&ldquo;<\/strong> creates a horizontal divider, resulting in stacked panes.\n            <\/p><\/div>\n\n\n\n<\/p><h3 class=\"wp-block-heading\"><strong>Navigate and resize panes<\/strong><\/h3><p>Once you split a window, typed commands affect only the currently active pane, which has a colored border. You need to move the focus to interact with other panes.<\/p><p>To switch between panes, press <strong>Ctrl + B<\/strong>, then use the arrow keys (<strong>Up<\/strong>, <strong>Down<\/strong>, <strong>Left<\/strong>, <strong>Right<\/strong>) to move in that direction. Alternatively, press <strong>Ctrl + B &rarr; O<\/strong> to cycle through panes sequentially.<\/p><p>Also, in some cases, the default <strong>50\/50<\/strong> split is not efficient. You might prefer a large coding pane and a smaller terminal output pane.<\/p><p>To resize panes, press <strong>Ctrl + B<\/strong>, then use <strong>Ctrl + arrow keys<\/strong>, such as <strong>Ctrl + Up<\/strong> or <strong>Ctrl + Down<\/strong>, to resize in steps of one cell. Use <strong>Meta + arrow keys<\/strong>, like <strong>Alt + Up<\/strong>, to resize in steps of five cells.<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"6a58f04c87352\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a58f04c87352\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/terminal-tmux-window-pane-resized-scaled.png\/w=1024,h=1024,fit=scale-down\" alt=\"tmux window showing resized panes for custom terminal layout\" class=\"wp-image-137641\"><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><h3 class=\"wp-block-heading\"><strong>Close panes<\/strong><\/h3><p>When you finish working in a pane, you can close it without affecting the rest of the window or session. There are three ways to do this, ranging from safe to forceful.<\/p><ul class=\"wp-block-list\">\n<li><strong>The shell method (recommended)<\/strong>. Type <strong>exit<\/strong> or press <strong>Ctrl + D<\/strong> in the command line. This safely ends the shell session, similar to logging out. If it is the last pane in the window, tmux closes the window.<\/li>\n\n\n\n<li><strong>The fast method<\/strong>. Press <strong>Ctrl + B &rarr; X<\/strong>. tmux displays a confirmation prompt at the bottom: <strong>kill-pane? y\/n<\/strong>. Press <strong>Y<\/strong> to confirm.<\/li>\n<\/ul><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"6a58f04c883e0\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a58f04c883e0\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/terminal-tmux-window-pane-kill-pane-highlighted-scaled.png\/w=1024,h=1024,fit=scale-down\" alt=\"tmux confirmation prompt for killing a pane highlighted\" class=\"wp-image-137642\"><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><ul class=\"wp-block-list\">\n<li><strong>The forced method<\/strong>. Press <strong>Ctrl + B &rarr; Shift + 7<\/strong> (the <strong>&amp;<\/strong> key). This kills the entire window and all panes inside it. Use this method only when you are sure you want to close everything in that view, as it can cause accidental data loss.<\/li>\n<\/ul><h2 class=\"wp-block-heading\" id=\"h-tmux-keybindings-and-shortcuts\"><strong>Tmux keybindings and shortcuts<\/strong><\/h2><figure tabindex=\"0\" class=\"wp-block-table\"><table><tbody><tr><td><strong>Shortcut<\/strong><\/td><td><strong>Action<\/strong><\/td><td><strong>Description<\/strong><\/td><td><strong>Use case<\/strong><\/td><\/tr><tr><td><strong>Ctrl + B &rarr; D<\/strong><\/td><td>Detach session<\/td><td>Disconnects you from the session while keeping it running.<\/td><td>Log off SSH while a script continues to run.<\/td><\/tr><tr><td><strong>Ctrl + B &rarr; C<\/strong><\/td><td>Create window<\/td><td>Opens a new shell in a separate tab.<\/td><td>Separate a new task, such as database management, from your current task.<\/td><\/tr><tr><td><strong>Ctrl + B &rarr; Shift + 5 (%)<\/strong><\/td><td>Split left and right<\/td><td>Divides the screen into left and right panes.<\/td><td>Read code on one side and logs on the other.<\/td><\/tr><tr><td><strong>Ctrl + B &rarr; Shift + &lsquo; (&ldquo;)<\/strong><\/td><td>Split top and bottom<\/td><td>Divides the screen into top and bottom panes.<\/td><td>Keep a monitoring tool, like <strong>top<\/strong>, visible below your work.<\/td><\/tr><tr><td><strong>Ctrl + B &rarr; X<\/strong><\/td><td>Kill pane<\/td><td>Closes the active pane after confirmation.<\/td><td>Remove a split pane you no longer need.<\/td><\/tr><tr><td><strong>Ctrl + B &rarr; ,<\/strong><\/td><td>Rename window<\/td><td>Changes the window name shown in the status bar.<\/td><td>Organize complex sessions with many windows.<\/td><\/tr><tr><td><strong>Ctrl + B &rarr; Z<\/strong><\/td><td>Zoom pane<\/td><td>Toggles the active pane between full screen and normal view.<\/td><td>Temporarily focus on a specific log file without closing other panes.<\/td><\/tr><tr><td><strong>Ctrl + B &rarr; [<\/strong><\/td><td>Copy mode<\/td><td>Enters copy mode to scroll through terminal history. Press <strong>Q<\/strong> to exit.<\/td><td>Review previous output or copy text.<\/td><\/tr><tr><td><strong>Ctrl + B &rarr; W<\/strong><\/td><td>List windows<\/td><td>Shows an interactive list of all windows in the session.<\/td><td>Navigate sessions when you have too many windows to remember by number.<\/td><\/tr><tr><td><strong>Ctrl + B &rarr; Shift + \/ (?)<\/strong><\/td><td>List key bindings<\/td><td>Displays a help screen with all configured keybindings.<\/td><td>Quickly look up a shortcut you have forgotten.<\/td><\/tr><\/tbody><\/table><\/figure><h2 class=\"wp-block-heading\" id=\"h-how-to-customize-tmux\"><strong>How to customize tmux<\/strong><\/h2><p>To customize tmux, <strong>create or edit the .tmux.conf configuration file, then add your custom settings<\/strong>. After saving the file, apply the changes by running <strong>tmux source-file ~\/.tmux.conf<\/strong> inside a tmux session.<\/p><p>The configuration file can be local (applying only to your user) or global (applying to all users on the server). We recommend using a local configuration file to avoid disrupting other users.<\/p><h3 class=\"wp-block-heading\"><strong>1. Create the configuration file<\/strong><\/h3><p>The local configuration file is named <strong>.tmux.conf<\/strong> and resides in your home directory. Starting with version <strong>3.2<\/strong>, tmux also checks <strong>$XDG_CONFIG_HOME\/tmux\/tmux.conf<\/strong> (typically <strong>~\/.config\/tmux\/tmux.conf<\/strong>).<\/p><p>Create or edit the file using the nano text editor:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">nano ~\/.tmux.conf<\/pre><h3 class=\"wp-block-heading\"><strong>2. Add configuration options<\/strong><\/h3><p>You can add commands to change tmux behavior. Below are two common and recommended <a href=\"\/ca\/tutorials\/tmux-config\/\">tmux customizations<\/a>.<\/p><ul class=\"wp-block-list\">\n<li><strong>Change the prefix key<\/strong>. The default <strong>Ctrl + B<\/strong> shortcut can feel awkward to reach with one hand. Many users prefer <strong>Ctrl + A<\/strong>, similar to GNU Screen. Add the following lines to rebind it:<\/li>\n<\/ul><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># Unbind the default prefix\nunbind C-b\n\n# Set the new prefix to Ctrl + A\nset -g prefix C-a\nbind C-a send-prefix<\/pre><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"6a58f04c88e42\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a58f04c88e42\" class=\"aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"596\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/62\/2025\/12\/Website-Development-alt-1.jpg\/w=1024,h=1024,fit=scale-down\" alt=\"Nano editor displaying the .tmux.conf configuration file\" class=\"wp-image-137643\"  sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><ul class=\"wp-block-list\">\n<li><strong>Enable mouse support<\/strong>. Modern versions of tmux support mouse input. This lets you resize panes and scroll through history by clicking and dragging instead of relying only on keyboard shortcuts.<\/li>\n<\/ul><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">set -g mouse on<\/pre><p>After making your changes, save the file and exit <strong>nano<\/strong> by pressing <strong>Ctrl + X &rarr; Y &rarr; Enter<\/strong>.<\/p><h3 class=\"wp-block-heading\"><strong>3. Apply the changes<\/strong><\/h3><p>Saving the file does not apply changes to the running tmux server. tmux reads <strong>.tmux.conf <\/strong>only when the server starts, not when you create new sessions.<\/p><p>To apply the new configuration immediately without restarting the server, run the following command inside a tmux session:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">tmux source-file ~\/.tmux.conf<\/pre><h2 class=\"wp-block-heading\" id=\"h-what-are-the-best-practices-for-using-tmux\"><strong>What are the best practices for using tmux?<\/strong><\/h2><p>Best practices for using tmux include <strong>creating a structured workspace, keeping sessions persistent and secure, and avoiding configuration bloat<\/strong>.<\/p><p>By treating tmux as a workspace manager rather than just a window splitter, you can significantly improve your command-line efficiency.<\/p><h3 class=\"wp-block-heading\"><strong>Organize workflows with tmux<\/strong><\/h3><p>Effective use of tmux starts with understanding its hierarchy: <strong>session &rarr; window &rarr; pane<\/strong>.<\/p><ul class=\"wp-block-list\">\n<li><strong>Sessions are for projects<\/strong>. Create a separate session for each major project, for example, <strong>client-website<\/strong> or <strong>server-maintenance<\/strong>. This approach prevents environment variables or command history from leaking between projects.<\/li>\n\n\n\n<li><strong>Windows are for tasks<\/strong>. Within a session, use windows for distinct tasks, like <strong>vim<\/strong>, <strong>database<\/strong>, or <strong>server-logs<\/strong>. Avoid cramming unrelated tasks into a single window.<\/li>\n\n\n\n<li><strong>Panes are for views<\/strong>. Use panes for immediate, side-by-side views, such as checking an error log while editing the code that caused it.<\/li>\n<\/ul><p>        <div class=\"protip\">\n            <div class=\"protip__heading\">\n                <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                    <path d=\"M1.49234 23.5024C1.23229 23.5024 0.972242 23.4024 0.782206 23.2123C0.562165 22.9923 0.452144 22.6822 0.502153 22.3722C0.562165 21.9221 1.14227 17.9113 3.00262 16.351C3.63274 15.8209 4.43289 15.5509 5.26305 15.5609C6.09321 15.5909 6.87335 15.9109 7.47347 16.4911C8.6937 17.6913 8.76371 19.6717 7.6435 20.9919C6.0832 22.8523 2.08245 23.4324 1.63237 23.4924C1.59236 23.4924 1.54235 23.4924 1.50234 23.4924L1.49234 23.5024ZM5.16303 17.5613C4.84297 17.5613 4.53291 17.6713 4.29287 17.8813C3.60274 18.4614 3.07264 19.9317 2.75258 21.242C4.06282 20.9219 5.5331 20.3918 6.11321 19.7017C6.55329 19.1716 6.54329 18.3814 6.0832 17.9213C5.85316 17.7013 5.5431 17.5713 5.20304 17.5613C5.19304 17.5613 5.17303 17.5613 5.16303 17.5613ZM11.7243 21.8821C11.4942 21.8821 11.2642 21.8021 11.0841 21.652C10.8541 21.462 10.7241 21.1819 10.7241 20.8819V15.9109L8.08358 13.2705H3.11264C2.81259 13.2705 2.53254 13.1404 2.3425 12.9104C2.15246 12.6803 2.07245 12.3803 2.12246 12.0902C2.19247 11.7102 2.84259 8.36953 4.70294 7.12929C6.33325 6.04909 8.96375 6.49918 10.244 6.80923C11.5442 4.96889 13.2546 3.4286 15.2349 2.33839C17.4553 1.11816 19.9858 0.518051 22.4963 0.498047C23.0464 0.498047 23.4865 0.948132 23.4865 1.49824C23.4865 5.0389 22.3763 9.97983 17.1753 13.7605C17.4853 15.0408 17.9354 17.6613 16.8552 19.2816C15.615 21.1419 12.2744 21.7921 11.8943 21.8621C11.8343 21.8721 11.7743 21.8821 11.7143 21.8821H11.7243ZM12.7245 16.181V19.6016C13.7146 19.2916 14.7948 18.7915 15.2049 18.1814C15.675 17.4812 15.605 16.091 15.385 14.9008C14.5248 15.3808 13.6346 15.8109 12.7245 16.181ZM9.66388 12.0302L11.9643 14.3307C13.1845 13.8306 14.3648 13.2204 15.485 12.5103C19.9358 9.51974 21.2361 5.60901 21.4561 2.53843C19.6157 2.67846 17.8254 3.20856 16.2051 4.09872C14.2847 5.14892 12.6544 6.68921 11.4942 8.54956C10.7841 9.65977 10.174 10.82 9.66388 12.0302ZM4.39289 11.2701H7.81353C8.1936 10.3599 8.63368 9.46974 9.11377 8.60957C7.92355 8.38953 6.51329 8.31952 5.81315 8.78961C5.19304 9.19968 4.70294 10.3099 4.39289 11.2701Z\" fill=\"#673DE6\"\/>\n                <\/svg>\n                <p class=\"protip__title\">\n                    &#128161; Pro tip                <\/p>\n            <\/div>\n            <p class=\"protip__content\"> Avoid running everything in a single window with many split panes. This makes the terminal hard to read and navigate. If a window becomes too cluttered, move a pane to its own window by pressing <strong>Ctrl + B &rarr; !<\/strong> (exclamation point).<\/p>\n                    <\/div>\n        \n\n\n\n<\/p><h3 class=\"wp-block-heading\"><strong>Recover from SSH disconnects<\/strong><\/h3><p>The most important function of tmux is session recovery. In a standard SSH session, if your Wi-Fi drops or your computer goes to sleep, the SSH connection breaks and sends a SIGHUP signal that terminates running commands.<\/p><p>tmux prevents this behavior. If your SSH connection times out:<\/p><ol class=\"wp-block-list\">\n<li>Log back into the server via SSH.<\/li>\n\n\n\n<li>Run <strong>tmux ls<\/strong> to find your previous session.<\/li>\n\n\n\n<li>Run <strong>tmux attach -t session-name<\/strong> to re-enter the environment.<\/li>\n<\/ol><p>Your cursor returns to the exact position where you left off, with command history and running processes intact.<\/p><h3 class=\"wp-block-heading\"><strong>Avoid common mistakes<\/strong><\/h3><p>Common tmux mistakes often come from treating it like a simple terminal tool rather than a session manager. Below are the most frequent issues and how to avoid them.<\/p><ul class=\"wp-block-list\">\n<li><strong>Nesting sessions<\/strong>. A common beginner mistake is running tmux inside an existing tmux session. This creates an &ldquo;Inception-like&rdquo; setup, where one tmux session runs inside another. It quickly becomes confusing because <strong>Ctrl + B<\/strong> commands affect only the inner session. To send the prefix to the inner session, you must press <strong>Ctrl + B<\/strong> twice. Avoid nesting unless you have a specific reason.<\/li>\n\n\n\n<li><strong>Forgetting to name sessions<\/strong>. While <strong>tmux new <\/strong>works, identifying the correct session from a list like <strong>0<\/strong>, <strong>1<\/strong>, or <strong>2<\/strong> is frustrating and error-prone. Always start sessions with a name using <strong>tmux new -s session-name<\/strong>.<\/li>\n\n\n\n<li><strong>Leaving unused sessions open<\/strong>. Each tmux session consumes memory. Idle sessions typically use only a few megabytes, but usage grows with the scrollback buffer size, which the <strong>history-limit <\/strong>option controls and defaults to 2000 lines per pane. Review active sessions regularly with <strong>tmux ls<\/strong> and remove unused ones with <strong>kill-session<\/strong>.<\/li>\n<\/ul><h2 class=\"wp-block-heading\" id=\"h-whats-the-next-step-in-your-terminal-workflow\"><strong>What&rsquo;s the next step in your terminal workflow?<\/strong><\/h2><p>After learning how to use tmux, the next step in your terminal workflow is to<strong> integrate it with secure remote management practices to build a more robust server environment<\/strong>.<\/p><p>To get more value from remote sessions, check our guide on <a href=\"\/ca\/tutorials\/basic-ssh-commands\/\">essential SSH commands<\/a>.<\/p><p>It covers core tasks such as navigating directories, managing files, and editing configuration files, all of which you will perform regularly inside tmux sessions.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A terminal multiplexer, or tmux, is a command-line tool that lets you manage multiple terminal sessions in a single window. With tmux, you can split panes, create multiple windows, and keep sessions active in the background. The primary benefit of tmux is persistence. If your SSH connection drops or you accidentally close your terminal emulator, [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/ca\/tutorials\/how-to-use-tmux\/\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":411,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"How to use tmux in %currentyear%","rank_math_description":"tmux is an application that lets you split terminal windows. Learn how to use tmux and find out some best practices. ","rank_math_focus_keyword":"how to use tmux","footnotes":""},"categories":[22699],"tags":[],"class_list":["post-15836","post","type-post","status-publish","format-standard","hentry","category-vps"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/how-to-use-tmux","default":0},{"locale":"fr-FR","link":"https:\/\/www.hostinger.com\/fr\/tutoriels\/comment-utiliser-tmux","default":0},{"locale":"es-ES","link":"https:\/\/www.hostinger.com\/es\/tutoriales\/como-usar-tmux","default":0},{"locale":"id-ID","link":"https:\/\/www.hostinger.com\/id\/tutorial\/tmux-cheat-sheet","default":0},{"locale":"en-GB","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/how-to-use-tmux","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/how-to-use-tmux","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/how-to-use-tmux","default":0},{"locale":"es-MX","link":"https:\/\/www.hostinger.com\/mx\/tutoriales\/que-son-hooks-wordpress-11","default":0},{"locale":"es-CO","link":"https:\/\/www.hostinger.com\/co\/tutoriales\/que-son-hooks-wordpress-11","default":0},{"locale":"es-AR","link":"https:\/\/www.hostinger.com\/ar\/tutoriales\/como-usar-tmux","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/how-to-use-tmux","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/how-to-use-tmux","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/how-to-use-tmux","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/how-to-use-tmux","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/posts\/15836","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/users\/411"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/comments?post=15836"}],"version-history":[{"count":50,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/posts\/15836\/revisions"}],"predecessor-version":[{"id":141730,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/posts\/15836\/revisions\/141730"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/media?parent=15836"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/categories?post=15836"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/tags?post=15836"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}