Adam Doupé

Assistant Professor, Arizona State University

Simple Bash Function: SSH and Keep Same Directory

| Comments

Here’s a quick Bash function that I whipped up to SSH into a server and keep the same directory. The use case for me is that I have a Dropbox shared between my laptop and server. Sometimes I need to run something (experiment, code, whatever) on the server. It was becoming annoying to ssh and then cd to the correct directory.

I call this function sshere (ssh here):

Feel free to use, steal, or adapt to your needs.