Skip to content

Latest commit

 

History

History
183 lines (126 loc) · 5.83 KB

File metadata and controls

183 lines (126 loc) · 5.83 KB

XSH

image

Stop typing long SSH commands. Save hosts, run commands, and switch environments instantly.

Go License Release status

Overview

XSH extends SSH functionality by providing a unified interface for storing, managing, and executing SSH connections. It eliminates the need to remember complex SSH commands, IP addresses, and configuration details by storing everything in a local SQLite database.

Motivation

Here's why XSH exists:

🎯 User-Friendly Interface Over Config Files

Yes, you can achieve similar functionality by manually editing ~/.ssh/config, but XSH provides a discoverable, interactive interface that doesn't require memorizing config file syntax. Add hosts through guided prompts, view them in beautiful tables, and connect with simple commands.

🚫 No More Alias Sprawl

Stop polluting your .bashrc or .zshrc with dozens of SSH aliases like alias prod1="ssh -i ~/.ssh/prod user@192.168.1.100". XSH centralizes all your connections in a structured database, keeping your shell config clean.

⚡ Effortless Resource Management

Adding, modifying, or deleting SSH configurations should be simple:

  • Add: Interactive prompts or JSON imports — no manual file editing
  • Modify: Clone existing hosts and tweak what you need
  • Delete: Interactive selection with referential integrity checks

🔍 Easy Discovery and Sharing

  • View all your hosts in formatted tables with xsh get host
  • Export configurations to JSON for backup or sharing
  • Auto-import existing SSH commands from your shell history during setup
  • Future: Remote backend support for team-wide configuration sharing

🎨 Modern Developer Experience

  • Beautiful terminal UI with color-coded themes
  • Interactive menus for host selection and cloning
  • Jump host support without manually constructing complex ProxyCommand strings
  • Organize hosts by regions for better infrastructure visibility

Installation

Install From Github

or you can use the following script directly

curl https://raw.githubusercontent.com/killshotrevival/xsh/refs/heads/main/install.sh | bash -

Build From Source

git clone https://github.com/killshotrevival/xsh.git
cd xsh

make build

# Placing the binary in required directory
mkdir -p ~/.local/bin
mv bin/xsh ~/.local/bin/
chmod +x ~/.local/bin/xsh

# Make sure the binary directory is present under $PATH
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc   # or ~/.zshrc

System Init

xsh init

xsh import

These command will initialize the xsh environment as well as read the following files to populate the database for configurations:

  • Identities in .ssh: Will look for all the identities files present in the .ssh directory and populate them in the database
  • .zshrc / .bashrc / .bash_history / .zsh_history: Read the config file for populating the already present host configurations
  • .ssh/config (TODO): Read the config file for populating the already present host configurations

Quick Start

Add New Resources

# This command will add a new region in the database that can be mapped to hosts
xsh put region us-east-1

# This command will add a new identity file using a unique name and its complete path
xsh put identity twelcon-development /Users/twelcon/.ssh/development

# Create an example file, that can be used for creating a new host
xsh example host -f host.json

# This command will add a new host according to the values declared in host.
xsh put host -f host.json

# This command can be used for viewing a list of all the hosts present
xsh get host

Connecting To A Host

xsh connect host-1

# For interactively selecting the host
xsh connect

# To connect in verbose mode
xsh connect host-1 -v

Pro Tips 😉

Importing Config

Use the following command for importing the already defined ssh configs under predefined files to xsh

xsh import

# Use -p flag for printing all the files xsh will be importing configurations from
xsh import -p

Clone A Host

In situation where maximum properties of a new host matches a host already present in the database, it makes more sense to clone a host instead of creating a new one from scratch

xsh put h

Clone host GIF

Edit Resource Interactively

Select resource to edit interactively

xsh edit

Interactive edit GIF

Delete Resources Interactively

Select resource to delete interactively and delete them

xsh delete

Interactive delete GIF

For More Details

Please follow this for more information

Roadmap 🚴🏻

For a detailed look at upcoming features — including remote backend support, SCP integration, direct SSH config management, and resource tagging — see the Roadmap.

Database Schema

XSH uses SQLite to store configuration with the following structure:

Table Description
hosts Host connection details (address, user, identity, jumphost)
identities SSH identity files (name, path)
regions Geographic regions for organization (name)

Configuration

The database is stored at ~/.xsh/xsh.db by default. Override with:

export XSH_DB_PATH=/custom/path/config.db

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.