{"id":13419849,"url":"https://github.com/greymd/tmux-xpanes","last_synced_at":"2025-05-14T02:05:05.924Z","repository":{"id":41811649,"uuid":"81563350","full_name":"greymd/tmux-xpanes","owner":"greymd","description":"Awesome tmux-based terminal divider","archived":false,"fork":false,"pushed_at":"2025-02-22T12:55:51.000Z","size":844,"stargazers_count":2003,"open_issues_count":19,"forks_count":64,"subscribers_count":30,"default_branch":"master","last_synced_at":"2025-04-14T00:57:01.586Z","etag":null,"topics":["bash","bash-script","cli","commands","tmux","tmux-plugins","zsh-completions"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/greymd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"greymd"}},"created_at":"2017-02-10T12:29:32.000Z","updated_at":"2025-04-10T03:34:48.000Z","dependencies_parsed_at":"2023-02-17T00:31:45.558Z","dependency_job_id":"1f848590-d079-4a3e-b2be-c502c5f4a734","html_url":"https://github.com/greymd/tmux-xpanes","commit_stats":{"total_commits":869,"total_committers":10,"mean_commits":86.9,"dds":"0.18872266973532792","last_synced_commit":"597262582d84ada121ffa00f9b132e8b119015c6"},"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/greymd%2Ftmux-xpanes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/greymd%2Ftmux-xpanes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/greymd%2Ftmux-xpanes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/greymd%2Ftmux-xpanes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/greymd","download_url":"https://codeload.github.com/greymd/tmux-xpanes/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254052692,"owners_count":22006716,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","bash-script","cli","commands","tmux","tmux-plugins","zsh-completions"],"created_at":"2024-07-30T22:01:21.852Z","updated_at":"2025-05-14T02:05:00.910Z","avatar_url":"https://github.com/greymd.png","language":"Shell","funding_links":["https://github.com/sponsors/greymd"],"categories":["Shell","Productivity","cli","\u003ca name=\"tools\"\u003e\u003c/a\u003eTools and session management"],"sub_categories":["Kubernetes"],"readme":"\u003ch1 align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/wiki/greymd/tmux-xpanes/img/xpanes_logo_1.png\" height=\"206\" width=\"208\" /\u003e\n  \u003ch4 align=\"center\"\u003eUltimate terminal divider powered by \u003ca href=\"https://tmux.github.io/\"\u003etmux\u003c/a\u003e\u003c/h2\u003e\n\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/greymd/tmux-xpanes/releases/latest\"\u003e\u003cimg src=\"https://img.shields.io/github/release/greymd/tmux-xpanes.svg\" alt=\"Latest version\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/greymd/tmux-xpanes/actions?query=workflow%3Atest\"\u003e\u003cimg src=\"https://github.com/greymd/tmux-xpanes/workflows/test/badge.svg?branch=master\" alt=\"Test Status\" /\u003e\u003c/a\u003e\n  \u003ca href=\"LICENSE\" alt=\"MIT License\"\u003e\u003cimg src=\"http://img.shields.io/badge/license-MIT-blue.svg?style=flat\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/wiki/greymd/tmux-xpanes/img/movie_v4.gif\" alt=\"Introduction Git Animation\" /\u003e\n\u003c/p\u003e\n\n## TL;DR\n\n#### Ping multiple hosts\n\n```sh\n$ xpanes -c \"ping {}\" 192.168.0.{1..9}\n```\n\n#### Connect to multiple hosts over SSH and start logging for each operation\n\n```sh\n$ xpanes --log=~/log --ssh user1@host1 user2@host2 user2@host3\n```\n\n#### Monitor CPU, Memory, Load, Processes and Disk info every seconds\n\n```sh\n$ xpanes -x -e \"top\" \"vmstat 1\" \"watch -n 1 df\"\n```\n\n#### Log in to multiple EC2 instances with Session Manager\n\n```sh\n$ xpanes -stc 'aws ssm start-session --target {}' i-abcdefg123 i-abcdefg456 i-abcdefg789\n```\n\n#### Operate running Docker containers on the interactive screen\n\n```sh\n$ docker ps -q | xpanes -s -c \"docker exec -it {} sh\"\n```\n\n\n# Features\n* Split tmux window into multiple panes\n  + Construct command lines \u0026 execute them on the panes\n* Runnable from outside of tmux session\n* Runnable from inside of tmux session\n* Record operation log\n* Flexible layout arrangement for panes\n  + Select layout presets\n  + Set columns or rows as you like\n* Display pane title on each pane\n* Generate command lines from standard input (Pipe mode)\n\n# Requirements\n\n* Bash (version 3.2 or later)\n* tmux (version 1.8 or later)\n\nIf you prefer older tmux versions (1.6 and 1.7),\nUse version [v2.2.3](https://github.com/greymd/tmux-xpanes/tree/v2.2.3).\n\n# Installation\n\nPlease refer to [wiki \u003e Installation](https://github.com/greymd/tmux-xpanes/wiki/Installation) in further details. Here is the some examples for installing.\n\n## With [Homebrew](https://github.com/Homebrew/brew) (for macOS users)\n\n```sh\n$ brew install tmux-xpanes\n```\n\n## With `dnf` (For Fedora users)\n\n```sh\n$ sudo dnf install xpanes\n```\n\n## With `dnf`, from EPEL (For RHEL/CentOS 8+ users)\n\n```sh\n$ sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-$(rpm --eval %rhel).noarch.rpm\n$ sudo dnf install xpanes\n```\n\n## With `yum`, from EPEL (For RHEL/CentOS 7 users)\n\n```sh\n$ sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-$(rpm --eval %rhel).noarch.rpm\n$ sudo yum install xpanes\n```\n\n## With `apt` (For Ubuntu users)\n\n```sh\n# Install `add-apt-repository` command, if necessary.\n$ sudo apt install software-properties-common\n\n$ sudo add-apt-repository ppa:greymd/tmux-xpanes\n$ sudo apt update\n$ sudo apt install tmux-xpanes\n```\n\n## With `dpkg` (For Debian users)\n\nPlease install tmux manually.\nAfter that, download deb file from [release page](https://github.com/greymd/tmux-xpanes/releases) and install.\n\n```\n$ wget https://github.com/greymd/tmux-xpanes/releases/download/v4.2.0/tmux-xpanes_v4.2.0.deb\n$ sudo dpkg -i tmux-xpanes*.deb\n$ rm tmux-xpanes*.deb\n```\n\n## With Zsh plugin managers\n\n**Attention:** With this way, please install tmux manually.\n\nAdd this line to `~/.zshrc` for [zplug](https://github.com/zplug/zplug).\nZsh-completion for `xpanes` is also available. See [Wiki \u003e Installation](https://github.com/greymd/tmux-xpanes/wiki/Installation).\n\n```sh\nzplug \"greymd/tmux-xpanes\"\n```\n\n## Manual Installation\n\n**Attention:** With this way, please install tmux manually.\n\n```sh\n# Download with wget\n$ wget https://raw.githubusercontent.com/greymd/tmux-xpanes/v4.2.0/bin/xpanes -O ./xpanes\n\n# Put it under PATH and make it executable.\n$ sudo install -m 0755 xpanes /usr/local/bin/xpanes\n```\n\n# Usage\n\nTwo commands `xpanes` and `tmux-xpanes` will be installed. They are actually same commands (`tmux-xpanes` is alias of `xpanes`). Use whichever you like.\n\n```\nUsage:\n  xpanes [OPTIONS] [argument ...]\n\nUsage(Pipe mode):\n  command ... | xpanes [OPTIONS] [\u003ccommand\u003e ...]\n\nOPTIONS:\n  -h,--help                    Display this help and exit.\n  -V,--version                 Output version information and exit.\n  -B \u003cbegin-command\u003e           Run \u003cbegin-command\u003e before processing \u003ccommand\u003e in each pane. Multiple options are allowed.\n  -c \u003ccommand\u003e                 Set \u003ccommand\u003e to be executed in each pane. Default is `echo {}`.\n  -d,--desync                  Make synchronize-panes option off in new window.\n  -e                           Execute given arguments as is. Same as `-c '{}'`\n  -I \u003crepstr\u003e                  Replacing one or more occurrences of \u003crepstr\u003e in command provided by -c or -B. Default is `{}`.\n  -C NUM,--cols=NUM            Number of columns of window layout.\n  -R NUM,--rows=NUM            Number of rows of window layout.\n  -l \u003clayout\u003e                  Set the preset of window layout. Recognized layout arguments are:\n                               t    tiled\n                               eh   even-horizontal\n                               ev   even-vertical\n                               mh   main-horizontal\n                               mv   main-vertical\n  -n \u003cnumber\u003e                  Set the maximum number of \u003cargument\u003e taken for each pane.\n  -r                           Create or reuse the existing panes.\n  -s                           Speedy mode: Run command without opening an interactive shell.\n  -ss                          Speedy mode AND close a pane automatically at the same time as process exiting.\n  -S \u003csocket-path\u003e             Set a full alternative path to the server socket.\n  -t                           Display each argument on the each pane's border as their title.\n  -x                           Create extra panes in the current active window.\n  --log[=\u003cdirectory\u003e]          Enable logging and store log files to ~/.cache/xpanes/logs or \u003cdirectory\u003e.\n  --log-format=\u003cFORMAT\u003e        Make name of log files follow \u003cFORMAT\u003e. Default is `[:ARG:].log.%Y-%m-%d_%H-%M-%S`.\n  --ssh                        Same as `-t -s -c 'ssh -o StrictHostKeyChecking=no {}'`.\n  --stay                       Do not switch to new window.\n  --bulk-cols=NUM1[,NUM2 ...]  Set number of columns on multiple rows (i.e, \"2,2,2\" represents 2 cols x 3 rows).\n  --interval=\u003cseconds\u003e         Set interval between each pane creation and each command execution.\n                               sleep(1) is used for the interval.\n  --debug                      Print debug message.\n```\n\n## Getting Started\n\nTry this command line.\n\n```sh\n$ xpanes 1 2 3 4\n```\n\nYou will get the screen like this.\n\n```\n    +-------------------------------+-------------------------------+\n    │$ echo 1                       │$ echo 2                       │\n    │1                              │2                              │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    +-------------------------------+-------------------------------+\n    │$ echo 3                       │$ echo 4                       │\n    │3                              │4                              │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    +-------------------------------+-------------------------------+\n```\n\nYou can split the window into multiple panes successfully, great!\nAs you can see, each argument of `xpanes` is re-assigned to `echo`'s argument.\n\nNext, let's close those panes.\nDon't worry if you are not familiar with key bindings of tmux.\nJust type `exit` and \"Enter\" key to close the panes.\n\n```\n    +-------------------------------+-------------------------------+\n    │$ exit                         │$ exit                         │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    +-------------------------------+-------------------------------+\n    │$ exit                         │$ exit                         │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    +-------------------------------+-------------------------------+\n```\n\nAs shown above, input from keyboard is synchronized within multiple panes by default.\n\n#### Suppress input synchronization\n\nTo disable the synchronization of keyboard input within panes, use `-d` (or `--desync`)  option. The input is applied to only one of them. Set `tmux synchronized-pane` `on` to re-enable synchronization.\n\n```\n$ xpanes -d 1 2 3 4\n```\n\n### `-c` option and `-I` option\n\n`-c` option is one of the fundamental options of `xpanes`.\nIts argument is used as a command to be executed.\nFor example, try this one.\n\n```sh\n$ xpanes -c 'seq {}' 1 2 3 4\n```\n\nYou will get the screen like this.\n\n```\n    +-------------------------------+-------------------------------+\n    │$ seq 1                        │$ seq 2                        │\n    │1                              │1                              │\n    │                               │2                              │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    +-------------------------------+-------------------------------+\n    │$ seq 3                        │$ seq 4                        │\n    │1                              │1                              │\n    │2                              │2                              │\n    │3                              │3                              │\n    │                               │4                              │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    +-------------------------------+-------------------------------+\n```\n\n`seq` command which generates sequential numbers is specified by `-c`.\nAs you can see, `{}` is replaced each arguments. This placeholder can be changed by `-I` option like this.\n\n```sh\n$ xpanes -I@ -c 'seq @' 1 2 3 4\n```\n\n`echo {}` is used as the default placeholder when no command is specified by `-c` option.\n\n[Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html) provided by Bash or Zsh is very useful to generate sequential numbers or alphabetical characters.\n\n```sh\n# Same as $ xpanes 1 2 3 4\n$ xpanes {1..4}\n```\n\n## Behavior modes\n\nIt is good to know about the conditional behavior of `xpanes` before checking further usages.\n\n\n### [Normal mode1] Outside of tmux session\n\nWhen the tmux is not open and `xpanes` is executed on the normal terminal, the `xpanes`'s behavior is as follows:\n\n - It newly creates a tmux session and new window on the session.\n - In addition, it separates the window into multiple panes.\n - Finally, the session will be attached.\n\n### [Normal mode2] Inside of tmux session\n\nWhen the tmux is already open and `xpanes` is executed on the existing tmux session, the command's behavior is as follows:\n\n - It newly creates a window **on the existing active session**.\n - In addition, it separates the window into multiple panes.\n - Finally, the window will be active.\n\nYou can use the -x option to create the panes in the current window.\n\nYou can use the -r option to create panes in the current window, or reuse the\nexisting ones.  It is useful if you want to rerun the same xpanes command over\nand over, e.g.:\n\nxpanes -r -B 'ssh `host`' -c '`program\u003e {}`' server client\n\nwill open 2 new panes.  When the host reboots, you can rerun the same command\nand the existing panes will be reused.\n\n### [Pipe mode] Inside of tmux session \u0026 Accepting standard input\n\nWhen `xpanes` accepts standard input (i.e, `xpanes` follows another command and pipe `|`) under **Normal mode2** , `xpanes`'s behavior is going to be the special one called \"Pipe mode\".\nIt is documented in the [Pipe mode section](#pipe-mode).\n\n## Further Examples\n\n#### Monitor multiple files\n\n```sh\n$ xpanes -c \"tail -f {}\" /var/log/apache/{error,access}.log /var/log/application/{error,access}.log\n```\n\nThe result is like this.\n\n```\n    +------------------------------------------+------------------------------------------+\n    │$ tail -f /var/log/apache/error.log       │$ tail -f /var/log/apache/access.log      │\n    │                                          │                                          │\n    │                                          │                                          │\n    │                                          │                                          │\n    │                                          │                                          │\n    │                                          │                                          │\n    │                                          │                                          │\n    │                                          │                                          │\n    │                                          │                                          │\n    │                                          │                                          │\n    +------------------------------------------+------------------------------------------+\n    │$ tail -f /var/log/application/error.log  │$ tail -f /var/log/application/access.log │\n    │                                          │                                          │\n    │                                          │                                          │\n    │                                          │                                          │\n    │                                          │                                          │\n    │                                          │                                          │\n    │                                          │                                          │\n    │                                          │                                          │\n    │                                          │                                          │\n    │                                          │                                          │\n    +------------------------------------------+------------------------------------------+\n```\n\nHmm? Do you want to monitor those files through the SSH? Just do it.\n\n```sh\n# 'ssh user@host' is added.\n$ xpanes -c \"ssh user@host tail -f {}\" \\\n/var/log/apache/{error,access}.log \\\n/var/log/application/{error,access}.log\n```\n\n#### Connecting multiple hosts over SSH with same user\n\n```sh\n$ xpanes -c \"ssh myuser@{}\" host1 host2\n```\n\n```\n    +-------------------------------+-------------------------------+\n    │$ ssh myuser@host1             │ $ ssh myuser@host2            │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    +-------------------------------+-------------------------------+\n```\n\n#### Use SSH with ignoring alert message\n\n`--ssh` option is helpful to ignore the alert message from OpenSSH. It is not required to answer yes/no question against it. Use it if you are fully sure that the connection is reliable one.\n\n```sh\n$ xpanes --ssh myuser1@host1 myuser2@host2\n```\n\nThis is same as below.\n\n```\n$ xpanes -t -s -c \"ssh -o StrictHostKeyChecking=no {}\" myuser1@host1 myuser2@host2\n```\n\n`-t` and `-s` options are introduced later.\n\n#### Connecting multiple hosts over SSH **AND logging operations**\n\n```sh\n$ xpanes --log=~/operation_log -c \"ssh {}\" user1@host1 user2@host2\n```\n\nThe result is like this.\n\n```\n    +-------------------------------+-------------------------------+\n    │$ ssh user1@host1              │ $ ssh user2@host2             │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    +-------------------------------+-------------------------------+\n```\n\nIn addition, log files will be created.\n\n```\n$ ls ~/operation_log/\nuser1@host1-1.log.2017-03-15_21-30-07\nuser2@host2-1.log.2017-03-15_21-30-07\n```\n\nFile name format for log file can be specified with `--log-format` option.\nPlease refer to [FORMAT](#format) for more information.\n\n**Attention:** Logging feature does not work properly with particular tmux versions. Please refer to [wiki \u003e Known Bugs](https://github.com/greymd/tmux-xpanes/wiki/Known-Bugs) in further details.\n\n#### Execute bash alias on multiple hosts via SSH\n\n```\n$ xpanes -c \"ssh -t {} bash -ci 'll'\" host-{1,2,3}\n```\n\n```\n    +------------------------------------+-------------------------------------+\n    │$ ssh -t host-1 bash -ci ll         │$ ssh -t host-2 bash -ci ll          │\n    │total 1234                          │total 1234                           │\n    │drwxr-xr-x 38 user user ... ./      │drwxr-xr-x 38 user user ... ./       │\n    │drwxr-xr-x  6 root root ... ../     │drwxr-xr-x  6 root root ... ../      │\n    │...                                 │...                                  │\n    │                                    │                                     │\n    │                                    │                                     │\n    │                                    │                                     │\n    │                                    │                                     │\n    │------------------------------------+-------------------------------------│\n    │$ ssh -t host-3  bash -ci ll                                              │\n    │total 1234                                                                │\n    │drwxr-xr-x 38 user user ... ./                                            │\n    │drwxr-xr-x  6 root root ... ../                                           │\n    │...                                                                       │\n    │                                                                          │\n    │                                                                          │\n    │                                                                          │\n    │                                                                          │\n    +------------------------------------+-------------------------------------+\n```\n\n#### Run commands promptly\n\n`-s` option is useful if you have following issues.\n\n * It takes long time to open the multiple new panes because default shell loads a bunch of configures (i.e `~/.zshrc` loads something ).\n * If you do not want to leave commands on your shell history.\n\nWith `-s` option, `xpanes` does not create a new interactive shell.\nInstead, a command is going to be executed as a direct child process of `xpanes`.\n\nHere is the example.\n\n```sh\n$ xpanes -s -c \"seq {}\" 2 3 4 5\n```\n\nAs you can see, each pane starts from command's result, not shell's prompt like `$ seq ...`.\n\n```\n    +------------------------------------------+------------------------------------------+\n    │1                                         │1                                         │\n    │2                                         │2                                         │\n    │Pane is dead: Press [Enter] to exit...    │3                                         │\n    │                                          │Pane is dead: Press [Enter] to exit...    │\n    │                                          │                                          │\n    │                                          │                                          │\n    │                                          │                                          │\n    │                                          │                                          │\n    │                                          │                                          │\n    │                                          │                                          │\n    +------------------------------------------+------------------------------------------+\n    │1                                         │1                                         │\n    │2                                         │2                                         │\n    │3                                         │3                                         │\n    │4                                         │4                                         │\n    │Pane is dead: Press [Enter] to exit...    │5                                         │\n    │                                          │Pane is dead: Press [Enter] to exit...    │\n    │                                          │                                          │\n    │                                          │                                          │\n    │                                          │                                          │\n    │                                          │                                          │\n    +------------------------------------------+------------------------------------------+\n```\n\nConfirmation message like \"Pane is dead...\" is displayed when every process ends.\nTo suppress the message, use `-ss` instead of `-s`.\n\n\n#### Display host always\n\n```sh\n$ xpanes -t -c \"ping {}\" 192.168.1.{5..8}\n```\n\nThe result is like this.\n\n![png image](https://raw.githubusercontent.com/wiki/greymd/tmux-xpanes/img/ping_pane_title.png)\n\nAs you notice, `-t` displays each argument on the each pane border.\nIt is called \"pane title\". The pane title is displayed with green background and black characters by default.\nSee [Environment variables](#shell-variables) section to change the default format.\n\n#### Create new panes on existing window\n\n`-x` option creates extra panes to the window.\nNew window is not created then.\n\nHere is the example `xpanes` is executed on the one of the three panes.\n\n```\n    +-------------------------------+-------------------------------+\n    │$                              │$                              │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    +-------------------------------+-------------------------------+\n    │ $ xpanes -x 4 5 6                                             │\n    │                                                               │\n    │                                                               │\n    │                                                               │\n    │                                                               │\n    │                                                               │\n    │                                                               │\n    │                                                               │\n    +-------------------------------+-------------------------------+\n```\n\nAdditional three panes are created.\n\n```\n    +-------------------------------+-------------------------------+\n    │$                              │$                              │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    │                               │                               │\n    +-------------------------------+-------------------------------+\n    │$ xpanes -x 4 5 6              │$ echo 4                       │\n    │$                              │4                              │\n    │                               │$                              │\n    │                               │                               │\n    │                               │                               │\n    +-------------------------------+-------------------------------+\n    │$ echo 5                       │$ echo 6                       │\n    │5                              │6                              │\n    │$                              │$                              │\n    │                               │                               │\n    │                               │                               │\n    +-------------------------------+-------------------------------+\n```\n\n#### Execute different commands on the different panes\n\n`-e` option executes given argument as it is.\n\n```sh\n$ xpanes -e \"top\" \"vmstat 1\" \"watch -n 1 free\"\n```\n\nThen the result will be like this.\n\n```\n    +-------------------------------+------------------------------+\n    │$ top                          │$ vmstat 1                    │\n    │                               │                              │\n    │                               │                              │\n    │                               │                              │\n    │                               │                              │\n    │                               │                              │\n    │                               │                              │\n    +-------------------------------+------------------------------+\n    │$ watch -n 1 free                                             │\n    │                                                              │\n    │                                                              │\n    │                                                              │\n    │                                                              │\n    │                                                              │\n    │                                                              │\n    +--------------------------------------------------------------+\n```\n\nYou will get the same result with this command line.\n\n```sh\n$ xpanes -I@ -c \"@\" \"top\" \"vmstat 1\" \"watch -n 1 free\"\n```\n\n#### Preprocessing for each pane\n\n`-B` option allows to run another command before processing `-c` option.\n\n```sh\n$ xpanes -B 'echo Preprocessing' -c 'echo Test' _\n```\n\n```\n    +-------------------------------+\n    │$ echo Preprocessing           │\n    │Preprocessing                  │\n    │$ echo Test                    │\n    │Test                           │\n    │                               │\n    │                               │\n    │                               │\n    +-------------------------------+\n```\n\n`-B` and `-c` are similar options.\nHowever, `-B` can be used multiple times.\n\n```sh\n$ xpanes -B 'echo Pre1' -B 'echo Pre2' -B 'echo Pre3' -c 'echo {}' A B C D\n```\n\n```\n    +-------------------------------+------------------------------+\n    │$ echo Pre1                    │$ echo Pre1                   │\n    │Pre1                           │Pre1                          │\n    │$ echo Pre2                    │$ echo Pre2                   │\n    │Pre2                           │Pre2                          │\n    │$ echo Pre3                    │$ echo Pre3                   │\n    │Pre3                           │Pre3                          │\n    │$ echo A                       │$ echo B                      │\n    +-------------------------------+------------------------------+\n    │$ echo Pre1                    │$ echo Pre1                   │\n    │Pre1                           │Pre1                          │\n    │$ echo Pre2                    │$ echo Pre2                   │\n    │Pre2                           │Pre2                          │\n    │$ echo Pre3                    │$ echo Pre3                   │\n    │Pre3                           │Pre3                          │\n    │$ echo C                       │$ echo D                      │\n    +-------------------------------+------------------------------+\n```\n\nIt is helpful to customize default `xpanes` behavior with `alias`.\nSee [Use alias](#use-alias).\n\n## Layout of panes\n\n### Columns and rows\n\n`-C` and `-R` options are useful to change tha layout of panes.\n\nA number of columns can be specified by `-C` (or `--cols`) option.\nHere is the example that panes are organized in 2 columns.\n\n```sh\n$ xpanes -C 2 AAA BBB CCC DDD EEE FFF GGG HHH III\n```\n\nThe result is like this.\n\n```\n    +------------------------------+------------------------------+\n    │$ echo AAA                    │$ echo BBB                    │\n    │                              │                              │\n    │                              │                              │\n    +------------------------------+------------------------------+\n    │$ echo CCC                    │$ echo DDD                    │\n    │                              │                              │\n    │                              │                              │\n    +------------------------------+------------------------------+\n    │$ echo EEE                    │$ echo FFF                    │\n    │                              │                              │\n    │                              │                              │\n    +------------------------------+------------------------------+\n    │$ echo GGG                    │$ echo HHH                    │\n    │                              │                              │\n    │                              │                              │\n    +------------------------------+------------------------------+\n```\n\nAs you may expect, `-R` (or `--rows`) option can fix the number of rows.\n\n```sh\n$ xpanes -R 5 AAA BBB CCC DDD EEE FFF GGG HHH\n```\n\nPanes are organized in 5 rows.\n\n```\n    +------------------------------+------------------------------+\n    │$ echo AAA                    │$ echo BBB                    │\n    │                              │                              │\n    +------------------------------+------------------------------+\n    │$ echo CCC                    │$ echo DDD                    │\n    │                              │                              │\n    +------------------------------+------------------------------+\n    │$ echo EEE                    │$ echo FFF                    │\n    │                              │                              │\n    +------------------------------+------------------------------+\n    │$ echo GGG                                                   │\n    │                                                             │\n    +-------------------------------------------------------------+\n    │$ echo HHH                                                   │\n    │                                                             │\n    +-------------------------------------------------------------+\n```\n\nEven if the number of arguments is not multiple of provided number, the number of panes on each row is adjusted to be as close as possible.\n\n### Set columns in bulk\n\n`--bulk-cols` accepts comma-separated numbers.\nEach number is corresponding to the number of columns of each row.\n\n```sh\n$ xpanes --bulk-cols=1,3,1,2,5 {A..L}\n```\n\nHere is the result.\n\n```\n    +-------------------------------------------------------------+\n    │$ echo A                                                     │\n    │                                                             │\n    +-------------------------------------------------------------+\n    │$ echo B            │$ echo C            │$ echo D           │\n    │                    │                    │                   │\n    +-------------------------------------------------------------+\n    │$ echo E                                                     │\n    │                                                             │\n    +-------------------------------------------------------------+\n    │$ echo F                      │$ echo G                      │\n    │                              │                              │\n    +-------------------------------------------------------------+\n    │$ echo H     │$ echo I    │$ echo J    │$ echo K   │$ echo L │\n    │             │            │            │           │         │\n    +-------------------------------------------------------------+\n```\n\nThe number of argument must equal to the sum of the comma-separated numbers.\nIn this example, the sum of the numbers of `--bulk-cols` is 12 (1 + 3 + 1 + 2 + 5 = 12) because there are 12 characters from A to L.\n\n### Layout presets\n\n`-l` option is also useful to change the layout of panes.\nFor example, to line up panes vertically, put `ev` (it is corresponding to `even-vertical` in [tmux manual](http://man7.org/linux/man-pages/man1/tmux.1.html)) followed by `-l`.\n\n```bash\n$ xpanes -l ev -c \"{}\" \"top\" \"vmstat 1\" \"watch -n 1 df\"\n```\n\nIt would be like this.\n\n```\n    +-------------------------------------------------------------+\n    │$ top                                                        │\n    │                                                             │\n    │                                                             │\n    │                                                             │\n    │                                                             │\n    +-------------------------------------------------------------+\n    │$ vmstat 1                                                   │\n    │                                                             │\n    │                                                             │\n    │                                                             │\n    │                                                             │\n    +-------------------------------------------------------------+\n    │$ watch -n 1 df                                              │\n    │                                                             │\n    │                                                             │\n    │                                                             │\n    │                                                             │\n    +-------------------------------------------------------------+\n```\n\nWith same way, `eh` (`even-horizontal`), `mv`(`main-vertical`) and `mh`(`main-horizontal`) are available. Please refer to `xpanes --help` also.\n\n## Pipe mode\n\nPipe mode is activated when `xpanes` command is accepting standard input.\nWith this mode, `xpanes` behaves like UNIX `xargs`.\n\n```sh\n# Pipe mode\n$ seq 3 | xpanes\n```\n\nWith this command line, the output would be like this.\n\n```\n    +------------------------------+------------------------------+\n    │$ echo 1                      │$ echo 2                      │\n    │1                             │2                             │\n    │                              │                              │\n    │                              │                              │\n    │                              │                              │\n    │                              │                              │\n    │                              │                              │\n    │                              │                              │\n    +------------------------------+------------------------------+\n    │$ echo 3                                                     │\n    │3                                                            │\n    │                                                             │\n    │                                                             │\n    │                                                             │\n    │                                                             │\n    │                                                             │\n    │                                                             │\n    +------------------------------+------------------------------+\n```\n\nPipe mode has two features.\n\n1. `xpanes`'s argument will be the common command line which will be used within all panes (this is same as the `-c` option's argument in Normal mode).\n1. Each line provided by standard input is corresponding to the each pane's command line (this is corresponding to normal argument of `xpanes` in Normal mode).\n\n\n```bash:tmux_session\n# The command line generates some numbers.\n$ seq 4\n1\n2\n3\n4\n\n# Add those numbers to xpanes command.\n$ seq 4 | xpanes seq\n```\n\nThe result will be like this.\n\n```\n    +-------------------------------+------------------------------+\n    │$ seq 1                        │$ seq 2                       │\n    │                               │                              │\n    │                               │                              │\n    │                               │                              │\n    │                               │                              │\n    │                               │                              │\n    │                               │                              │\n    │                               │                              │\n    +-------------------------------+------------------------------+\n    │$ seq 3                        │$ seq 4                       │\n    │                               │                              │\n    │                               │                              │\n    │                               │                              │\n    │                               │                              │\n    │                               │                              │\n    │                               │                              │\n    │                               │                              │\n    +-------------------------------+------------------------------+\n```\n\nOf course, `-c` and `-I` options are available.\n\n```sh\n$ seq 4 | xpanes -c 'seq {}'\n## xpanes seq\n##    and\n## xpanes -c 'seq {}'\n##    are same.\n```\n\nHowever, giving both `-c` and any arguments causes error. Because the command cannot decide which argument should be used.\n\n```bash:tmux_session\n$ echo test | xpanes -c 'echo {}' echo\nxpanes:Error: Both arguments and other options (like '-c', '-e') which updates \u003ccommand\u003e are given.\n```\n\n### Connecting to multiple hosts given by `~/.ssh/config`\n\nPipe mode allows you to make combinations between tmux and other general UNIX commands.\nFor example, let's prepare `~/.ssh/config` file like this.\n\n```text\nHost host1\n    User user1\n    HostName 192.168.0.2\n    IdentityFile ~/.ssh/id_rsa\n\nHost host2\n    User user2\n    HostName 192.168.0.3\n    IdentityFile ~/.ssh/id_rsa\n\nHost host3\n    User user3\n    HostName 192.168.0.4\n    IdentityFile ~/.ssh/id_rsa\n```\n\nParse host name with general UNIX commands.\n\n```sh\n$ cat ~/.ssh/config | awk '$1==\"Host\"{print $2}'\nhost1\nhost2\nhost3\n```\n\nGiving the results to `xpanes ssh` command.\n\n```sh\n$ cat ~/.ssh/config | awk '$1==\"Host\"{print $2}' | xpanes ssh\n```\n\nThe results would be like this.\n\n```\n    +------------------------------+------------------------------+\n    │$ ssh host1                   │$ ssh host2                   │\n    │                              │                              │\n    │                              │                              │\n    │                              │                              │\n    │                              │                              │\n    │                              │                              │\n    │                              │                              │\n    │                              │                              │\n    +------------------------------+------------------------------+\n    │$ ssh host3                                                  │\n    │                                                             │\n    │                                                             │\n    │                                                             │\n    │                                                             │\n    │                                                             │\n    │                                                             │\n    │                                                             │\n    +------------------------------+------------------------------+\n```\n\n## Operate session\n\n### Recover disconnected session\n\nYou may restore the tmux session created by `xpanes` even if it is unexpectedly disconnected from your terminal.\n`xpanes` creates `~/.cache/xpanes/socket.\u003cPID\u003e` file as socket file by default.\n\nTry to find socket file like this.\n\n```sh\n$ ls ~/.cache/xpanes/socket.*\n/home/user/.cache/xpanes/socket.1234\n```\n\nIf you find any socket files, try to attach it.\nThe session might be recovered.\n\n```sh\n$ tmux -S /home/user/.cache/xpanes/socket.1234 attach\n```\n\n### Share terminal sessions with others\n\nYou can specify the socket file name with `-S` option.\nImporting this socket file, different users can share their screens each other.\n\n* user1\n\n```sh\n[user1@host] $ xpanes -S /home/user1/mysocket a b c d ...\n```\n\n* user2\n\n```sh\n[user2@host] $ tmux -S /home/user1/mysocket attach\n```\n\n... then, user1 and user2 can share their screen.\n\n## FORMAT\n\nFile name of log file generated by `--log` option can be changed by `--log-format=FORMAT`.\n\nDefault value of `FORMAT` is `[:ARG:].log.%Y-%m-%d_%H-%M-%S`.\n\nInterpreted sequences are:\n\n* `[:PID:]` --  Process id of the tmux session\n* `[:ARG:]` --  Argument name\n\nIn addition, sequences same as `date(1)` are available.\n\nFor example:\n\n* `%Y` --  year  (e.g, 1960)\n* `%m` --  month (e.g, 01)\n* `%d` --  date  (e.g, 31)\n\nAnd etc.\n\nOther sequences are also available.\nRefer to `date(1)` manual.\n\n## Use alias\n\n### Get index number\n\nAs mentioned before, `-B` option is helpful to improve your xpanes with `alias`.\nFor example, define the alias like this.\n\nAlias:\n```sh\n_tmp='INDEX=`tmux display -pt \"${TMUX_PANE}\" \"#{pane_index}\"`'\nalias xpanes=\"xpanes -B '${_tmp}'\"\n```\n\nAfter that, execute this command.\n\n```sh\n$ xpanes -sc 'echo $INDEX' _ _ _ _\n```\n\n```\n    +-------------------------------+------------------------------+\n    │$ echo $INDEX                  │$ echo $INDEX                 │\n    │0                              │1                             │\n    │                               │                              │\n    │                               │                              │\n    │                               │                              │\n    │                               │                              │\n    │                               │                              │\n    +-------------------------------+------------------------------+\n    │$ echo $INDEX                  │$ echo $INDEX                 │\n    │2                              │3                             │\n    │                               │                              │\n    │                               │                              │\n    │                               │                              │\n    │                               │                              │\n    │                               │                              │\n    +-------------------------------+------------------------------+\n```\n\nAs shown above, `$INDEX` has the index number of pane.\nThis technique is helpful to avoid that all the commands start simultaneously.\nTo wait each command start every second, just do it with the above alias.\n\n```sh\n$ xpanes -B 'sleep $INDEX' -c 'command {}' argA argB argC ...\n```\n\nSee [wiki \u003e Alias examples](https://github.com/greymd/tmux-xpanes/wiki/Alias-examples) for more useful examples.\n\n## Shell variables\n\n`xpanes` refers to following shell variables.\nAdd the statement to your default shell's\nstartup file file (i.e `.bashrc`, `.zshrc`) to change them as you like.\n\n### `XDG_CACHE_HOME`\n\ntmux-xpanes follows [XDG Base Directory Specification](https://specifications.freedesktop.org/basedir-spec/basedir-spec-0.6.html).\n`XDG_CACHE_HOME` is `$HOME/.cache` by default.\nTherefore, `$HOME/.cache/xpanes` directory is used to store temporary data by default.\n\n### `TMUX_XPANES_EXEC`\n\n**DEFAULT VALUE:** `tmux`\n\nIt is preferentially used as a internal `tmux` command.\nIt is helpful if you want to use specific tmux version for xpanes, or enable specific options always.\n\nExample:\n\n```sh\nexport TMUX_XPANES_EXEC=\"/usr/local/bin/tmux1.8 -2\"\n# =\u003e xpanes command calls \"/usr/local/bin/tmux1.8 -2\" internally.\n```\n\n### `TMUX_XPANES_LOG_DIRECTORY`\n\n**DEFAULT VALUE:** `$HOME/.cache/xpanes/logs`\n\nPath to store log files generated by `--log` option.\nIt is ignored if the path is explicitly given by `--log=`.\n\n### `TMUX_XPANES_LOG_FORMAT`\n\n**DEFAULT VALUE:** `[:ARG:].log.%Y-%m-%d_%H-%M-%S`\n\nFormat of the log file name generated by `--log` option.\nIt is ignored if the format is explicitly given by `--log-format=`.\n\nExample:\n\n```sh\nexport TMUX_XPANES_LOG_FORMAT=\"[:ARG:]_mylog.log\"\n```\n\n### `TMUX_XPANES_PANE_BORDER_FORMAT`\n\n**DEFAULT VALUE:** `#[bg=green,fg=black] #T #[default]`\n\nIt defines format of the pane's title.\nSee [FORMATS section in man of tmux](http://man7.org/linux/man-pages/man1/tmux.1.html#FORMATS) for further details.\nIt overwrites tmux's [`pane-border-format`](http://man7.org/linux/man-pages/man1/tmux.1.html#OPTIONS) in the `xpanes`'s session.\n\nThere are some examples [here](https://github.com/greymd/tmux-xpanes/wiki/Utilize-pane-title).\n\n### `TMUX_XPANES_PANE_BORDER_STATUS`\n\n**DEFAULT VALUE:** `bottom`\n\nIt defines location of the pane's title.\nIt overwrites tmux's [`pane-border-status`](http://man7.org/linux/man-pages/man1/tmux.1.html#OPTIONS) in the `xpanes`'s session.\n\nExample:\n\n```sh\n# Change value from bottom to top\nexport TMUX_XPANES_PANE_BORDER_STATUS=\"top\"\n```\n\n### `TMUX_XPANES_PANE_DEAD_MESSAGE`\n\n**DEFAULT VALUE:** `\\033[41m\\033[4m\\033[30m Pane is dead: Press [Enter] to exit... \\033[0m\\033[39m\\033[49m`\n\nIt defines the message that displayed when a process exits with `-s` option enabled.\n\nThe message is underlined black character on the red background (see [Ansi escape codes](http://ascii-table.com/ansi-escape-sequences.php)) by default.\n\nExample:\n\n```sh\n## Set green color\nexport TMUX_XPANES_PANE_DEAD_MESSAGE='\\033[32m=== EXIT ==='\n```\n\n### `TMUX_XPANES_TMUX_VERSION`\n\n**DEFAULT VALUE:** empty\n\nIt forces the tmux version recognized by `xpanes`.\nIt is mainly used for testing purposes.\nIt is also useful if you are using a newer tmux that has not been released yet, or if you have customized the tmux itself and want to suppress unwanted warning messages from xpanes.\n\nExample:\n```sh\n$ tmux -V\ntmux customized-3.3\n$ xpanes 1 2 3\nxpanes:Warning: 'xpanes' may not work correctly! ...\n...\n$ export TMUX_XPANES_TMUX_VERSION=1.8\n$ xpanes 1 2 3\n```\n=\u003e It works without warning messages.\n\n## ... and [let's play!](https://github.com/greymd/tmux-xpanes/wiki/Let's-play!)\n\n# Contributing\n\nPlease check out the [CONTRIBUTING](CONTRIBUTING.md) about how to proceed.\n\n## Testing\n\nPlease note the following points before running the test.\n\n* Run it from **outside of tmux session**\n* Set `allow-rename` option **off**\n\nFollow this.\n\n```sh\n## Clone repository together with shunit2 (kward/shunit2)\n$ git clone --recursive https://github.com/greymd/tmux-xpanes.git\n$ cd tmux-xpanes\n\n## Suppress window name change\n$ echo 'set-window-option -g allow-rename off' \u003e\u003e ~/.tmux.conf\n$ echo 'set-window-option -g automatic-rename off' \u003e\u003e ~/.tmux.conf\n\n## Run smoke test\n$ bash test/cases_smoke.sh\n\n## =\u003e Testing will start ...\n```\n\n# License\n\n## Source code\nThe scripts is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n\n## Logo\n\u003ca rel=\"license\" href=\"http://creativecommons.org/licenses/by-nc/4.0/\"\u003e\u003cimg alt=\"Creative Commons License\" style=\"border-width:0\" src=\"https://i.creativecommons.org/l/by-nc/4.0/88x31.png\" /\u003e\u003c/a\u003e\u003cbr /\u003eThe logo of tmux-xpanes is licensed under a \u003ca rel=\"license\" href=\"http://creativecommons.org/licenses/by-nc/4.0/\"\u003eCreative Commons Attribution-NonCommercial 4.0 International License\u003c/a\u003e.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgreymd%2Ftmux-xpanes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgreymd%2Ftmux-xpanes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgreymd%2Ftmux-xpanes/lists"}