A small script I built to stop retyping the same ssh/scp commands all day.
git clone https://github.com/mengdotzip/Meng-Script.git
cd Meng-ScriptTo use it from anywhere without the ./:
mkdir -p ~/.local/bin
cp meng.sh ~/.local/bin/mengIf ~/.local/bin isn't in your PATH yet, add this to your .bashrc or .zshrc:
export PATH="$HOME/.local/bin:$PATH"Tab completion
- bash
mkdir -p ~/.local/share/bash-completion/completions
cp meng-completion.bash ~/.local/share/bash-completion/completions/meng
source ~/.local/share/bash-completion/completions/meng- zsh
mkdir -p ~/.local/share/zsh/site-functions
cp _meng ~/.local/share/zsh/site-functions/_mengAdd to ~/.zshrc if not already there:
fpath=(~/.local/share/zsh/site-functions $fpath)
autoload -Uz compinit && compinitReload without restarting your shell:
unfunction _meng 2>/dev/null; autoload -Uz _meng# save a server
meng add prod admin@192.168.1.100:/opt/app/
# save a server with a custom SSH port
meng add staging admin@192.168.1.100:/opt/app/ -p 2222
# or just SSH in normally, then save it after
ssh admin@192.168.1.100
meng ingest prod !!
# ingest an SSH command that uses a custom port
ssh -p 2222 admin@192.168.1.100
meng ingest staging !!
# connect / copy / deploy (port is used automatically)
meng ssh prod
meng scp prod build/myapp
meng scp prod dist/ -r
meng deploy prod myapp
# scripts
meng script add backup ~/scripts/rclone_backup.sh
meng run backup
# scripts with parameters
# - store fixed default args, add more at call time:
meng script add setup-env ~/scripts/setup-code-env.sh vscode-box
meng run setup-env # runs: setup-code-env.sh vscode-box
meng run setup-env remcsc # runs: setup-code-env.sh vscode-box remcsc
# - need the call-time args somewhere other than the end? use a {} placeholder:
meng script add setup-env ~/scripts/setup-code-env.sh --box vscode-box {} --verbose
meng run setup-env remcsc # runs: setup-code-env.sh --box vscode-box remcsc --verbose
# see everything
meng listEverything lives in ~/.config/meng/ — created automatically on first run.
~/.config/meng/
├── aliases # your servers
└── scripts # your script shortcuts
Plain text, one entry per line. Worth backing up or sticking in a dotfiles repo.
meng ssh <alias>
meng scp <alias> <file> [-r] [-p <path>]
meng deploy <alias> <file>
meng info <alias>
meng add <name> <user@host:/path> [-p <port>]
meng remove <name>
meng ingest <name> [ssh] <user@host>
meng list
meng run <name> [args...]
meng script add <name> <path> [args...]
meng script remove <name>
-ponscpwith a leading/replaces the alias path entirely, without one it appends to it.-p <port>onaddsets a custom SSH/SCP port, stored in the alias and applied automatically.runappends any args you pass after the script's stored default args; a{}placeholder in the stored args is replaced by them instead. Scripts run via their own shebang (orshif they have none).deployassumes a Go project and runsgo buildfirst.