{"id":16974928,"url":"https://github.com/luciopaiva/itermoxyl","last_synced_at":"2025-03-22T14:31:36.049Z","repository":{"id":41971879,"uuid":"236872550","full_name":"luciopaiva/itermoxyl","owner":"luciopaiva","description":"Tool to automatically open multiple ssh connections in iTerm2 by querying ~/.ssh/config.","archived":false,"fork":false,"pushed_at":"2022-04-21T10:48:46.000Z","size":524,"stargazers_count":32,"open_issues_count":3,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-18T12:02:49.058Z","etag":null,"topics":["iterm2","itermocil","ssh","ssh-config","teamocil"],"latest_commit_sha":null,"homepage":"","language":"Python","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/luciopaiva.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-01-29T00:22:17.000Z","updated_at":"2025-03-17T16:00:52.000Z","dependencies_parsed_at":"2022-08-12T01:00:59.152Z","dependency_job_id":null,"html_url":"https://github.com/luciopaiva/itermoxyl","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luciopaiva%2Fitermoxyl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luciopaiva%2Fitermoxyl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luciopaiva%2Fitermoxyl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luciopaiva%2Fitermoxyl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luciopaiva","download_url":"https://codeload.github.com/luciopaiva/itermoxyl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244972070,"owners_count":20540917,"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":["iterm2","itermocil","ssh","ssh-config","teamocil"],"created_at":"2024-10-14T01:08:43.291Z","updated_at":"2025-03-22T14:31:35.601Z","avatar_url":"https://github.com/luciopaiva.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n![iTermoxyl](banner.png)\n\n# iTermoxyl\n\niTermoxyl is command line tool to automatically open multiple ssh connections in [iTerm2](https://iterm2.com/) by directly querying `~/.ssh/config` using patterns provided via the command line.\n\n![example](example.gif)\n\nIt is a slightly different medicine for a slightly different problem. iTermoxyl was inspired by [itermocil](https://github.com/TomAnthony/itermocil), which was inspired by [teamocil](https://github.com/remiprev/teamocil).\n\niTermoxyl is designed to be simple to use, with minimal interaction needed to get it running. Once ssh connections are established, use iTerm2's broadcast input feature to send commands to all machines at once (`Shell -\u003e Broadcast input` or simply `cmd + shift + i`).\n\nFeatures:\n\n- magically learns about existing hosts by reading from `~/.ssh/config`\n- doesn't require any configuration files (tools like `itermocil` and `i2cssh` require you to manually create YAML descriptions of your environments)\n- smart pattern matching: no need to type in the name of each machine you want to connect to\n- supports [ssh config Include directives](https://man.openbsd.org/ssh_config#Include)\n- supports loose matches (see below)\n\n## How to install\n\n`cd` to the destination directory and:\n\n    curl -O https://raw.githubusercontent.com/luciopaiva/itermoxyl/master/itermoxyl\n    chmod u+x itermoxyl\n\nMake sure to add it to the path so it can be called anywhere.\n\nYou need to have iTerm2 installed (obviously), but nothing else. The script is written in Python 2.7 and your macOS already comes with it.\n\n## How to use\n\nConsider the following sample `~/.ssh/config` file:\n\n```\nHost foo-1\n    HostName 10.0.0.1\nHost foo-2\n    HostName 10.0.0.2\nHost foo-3\n    HostName 10.0.0.3\nHost foo-4\n    HostName 10.0.0.4\nHost foo-5\n    HostName 10.0.0.5\n\nHost bar-1\n    HostName 10.0.1.1\nHost bar-2\n    HostName 10.0.1.2\n\nHost server-1-a\n    HostName 192.168.0.1\nHost server-1-b\n    HostName 192.168.0.2\nHost server-2-a\n    HostName 192.168.1.1\nHost server-2-b\n    HostName 192.168.1.2\n```\n\nLet's try a few combinations. To open:\n\n1. all `foo` machines:\n\n       itermoxyl foo\n\n2. `foo-2` and `bar-2`:\n\n       itermoxyl foo,bar 2\n\n3. `server-1-a` and `server-2-a`:\n\n       itermoxyl server a\n\n4. `foo-1`, `foo-2`, `foo-3`:\n\n       itermoxyl foo 1-3\n\n5. `foo-1`, `foo-3`, `foo-4`, `foo-5`:\n\n       itermoxyl foo 1,3-5\n\n### The underlying pattern-matching algorithm\n\nThe general rule is:\n\n    itermoxyl TERM_0 TERM_1 ... TERM_N\n\nTerms will be joined into the following regular expression:\n\n    (?:TERM_0).*?(?:TERM_1).*?(?:TERM_N)\n\nWhich acts as a kind of a loose search. Moreover, each term is treated as a potential comma-separated list of names:\n\n    TERM =\u003e NAME_0,NAME_1,...,NAME_N\n\nWhich will get converted to the following regular expression:\n\n    (?:NAME_0|NAME_1|NAME_N)\n\nThis allows for matches like the `foo,bar` in the example above.\n\nFinally, the last term in a list with more than one term is treated differently. If its name parts are actually numbers, they will exceptionally be translated into the following regular expression:\n\n    (?\u003c!\\d)(?:NUMBER_0|NUMBER_1|NUMBER_N)$\n\nThis was implemented to match specific machine numbers. We usually have a series of machines sharing a same prefix and only differing by the number at the end. Even if the common prefix has numbers in them, we almost never want to match those numbers, only the ones at the very end. That's why this special regular expression has the `$` at the end. Moreover, if we specify number `2`, we usually want to match only `2` and not `12`; that's why the expression has a negative lookbehind making sure that no `\\d` precedes our intended number.\n\nWell, there's one last bit. Each `NUMBER` in the pattern above can actually be a range; for instance, `1-5`. iTermoxyl will try and match ranges, expanding them accordingly. So if the last term passed in the command line is `1,3-5,8-10,12`, the resulting expanded version will be `1,3,4,5,8,9,10,12`.\n\nThe script will always show all hosts matching your query and ask for confirmation before actually connecting to them.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluciopaiva%2Fitermoxyl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluciopaiva%2Fitermoxyl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluciopaiva%2Fitermoxyl/lists"}