You can get the path mounted via sshfs from the output of mount
(or simply remember it). Then you can either
build an alias that takes a path on the client, removes the mountpoint of the SSHfs and prepends the original name of the directory on the server. For example, if you mount the remote directory
/var/www/mywebsite
locally to/home/test/website
(sshfs server:/var/www/mywebsite /home/test/website
), then the following will work:$ alias mpwd="pwd | sed 's|^/home/test/website|/var/www/mywebsite|'" $ pwd /home/test/website $ mpwd /var/www/mywebsite $ cd gallery $ mpwd /var/www/mywebsite/gallery $ cd /etc $ mpwd /etc
Note how non-matching directories (
/etc
) are not mangled.mount the remove directory at the same location locally, that is, execute sshfs for example like:
sshfs server:/var/www/mywebsite /var/www/mywebsite
. The directory obviously has to exist locally for that to work.