In case, you wish a ssh wrapper: #!/bin/zsh -f # Usage: ssh -ARG login@hostname:/go/to/directory/path t=(${(s.:.)@[-1]}) if [ -n "${t[2]}" ]; then exec /usr/bin/ssh -t ${@[1,-2]} ${t[1]} "cd ${t[2]}; exec \$SHELL -l" else exec /usr/bin/ssh $@ fi 2015-07-30 9:55 GMT+02:00 Dominik Vogt : > > > On 30 July 2015 at 07:24, Dominik Vogt wrote: > > > Often, I ssh to another machine, and the first thing I do there is > > > to change the working directory, e.g. > > > > > > $ ssh > > > $ cd ~/src/git/... > > > > > > I'm looking for a way to specify that in some way on the ssh > > > command line but cannot figure out how to do that. Zsh takes > > > either input from stdin, or from a command specified with -c, or > > > from a script, so things like > > > > > > $ ssh <...> zsh -c 'cd ~/src/git' -s > > > > > > or > > > > > > $ ssh <...> zsh -s