A faster, funkier alternative to vagrant ssh
.
dobbin add https://github.com/shkm/vssh vssh
brew install shkm/brew/vssh
Copy or symlink vssh
to a place in your path.
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
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
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
You might find the following shell functions useful in combination with vssh.
v
andv ssh
will SSH into the machine with vsshv <command>
will run the command inside the machine with vsshv <vagrant command>
will run the command against vagrant (e.g.v up
orv status
).
Grab the function here.
Grab the function here. Better yet, install with fisherman: fisher install shkm/vssh
.
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
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
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
- Too much waiting
- A repo with projects as submodules
- vassh