Adam Doupé

Associate Professor, Arizona State University
Director, Center for Cybersecurity and Trusted Foundations

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.