https://github.com/shkm/vssh
:zap: Fast `vagrant ssh` in the current directory.
https://github.com/shkm/vssh
shell ssh vagrant
Last synced: 11 months ago
JSON representation
:zap: Fast `vagrant ssh` in the current directory.
- Host: GitHub
- URL: https://github.com/shkm/vssh
- Owner: shkm
- License: mit
- Created: 2016-06-19T09:41:00.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2017-09-23T12:36:25.000Z (over 8 years ago)
- Last Synced: 2025-04-11T15:57:54.245Z (about 1 year ago)
- Topics: shell, ssh, vagrant
- Language: Shell
- Homepage:
- Size: 17.6 KB
- Stars: 28
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vssh
A faster, funkier alternative to `vagrant ssh`.
## Install
### [Dobbin](https://github.com/shkm/dobbin)
```
dobbin add https://github.com/shkm/vssh vssh
```
### Homebrew
```
brew install shkm/brew/vssh
```
### Generic
Copy or symlink `vssh` to a place in your path.
## Features
### Fast
`vagrant ssh` is slow. `vssh` is fast.
On my 2014 Macbook Air:
```
$ time vssh
vssh 0.02s user 0.01s system
$ time vagrant ssh
vagrant ssh 2.18s user 0.43s system
```
### Contextual
`vssh` figures out which directory it should be in after SSHing into the box.
Easiest way to describe this is with an example. Assuming vagrant user is `vagrant` and your project's route is synced to `/vagrant`:
```
$ pwd
my_vagrant_project/foo/bar
$ vagrant ssh
$ pwd
/home/vagrant
$ vssh
$ pwd
/vagrant/foo/bar
```
### Convenient
Oh, yeah, you can just throw a command at `vssh` and it'll execute inside the box without leaving you there. This uses a login shell and same directory rules as plain old `vssh`.
```
$ uname
Darwin
$ vssh uname
Linux
```
## Shell
You might find the following shell functions useful in combination with vssh.
- `v` and `v ssh` will SSH into the machine with vssh
- `v ` will run the command inside the machine with vssh
- `v ` will run the command against vagrant (e.g. `v up` or `v status`).
### zsh
Grab the function [here](https://github.com/shkm/vssh/blob/master/functions/v.zsh).
### fish
Grab the function [here](https://github.com/shkm/vssh/blob/master/functions/v.fish). Better yet, install with [fisherman](https://github.com/fisherman/fisherman): `fisher install shkm/vssh`.
## Details
Either run `vssh` or `vssh some_command` to ssh into the box or run a command inside it, respectively. `vssh --help` is always available.
vssh generates two files: `.vagrant/ssh_config` and `.vagrant/vssh.cfg`.
### `ssh_config`
`ssh_config` is populated if not found (this actually calls vagrant, and is therefore slow). if your box's ssh config changes, you can refresh this with `vssh --refresh`.
### `vssh.cfg`
`vssh.cfg` is generated interactively if not found. Currently the only required option is the root directory you'd like to be dumped into relative to your host directory.
Assuming your main synced folder (`.`) is mounted at `/vagrant`, you'd set the root directory to `/vagrant`.
To re-run `vssh.cfg` generation, execute `vssh --generate`
## Inspiration
- Too much waiting
- A repo with projects as submodules
- [vassh](https://github.com/xwp/vassh)