Even better: make the script work with local paths as well. Then you can put alias cd='sshcd' in your .bashrc, and you won't have to distinguish between local and remote paths ever again.
I was thinking about aliasing cd like that and instead having psuedo-directories that you can cd into to SSH into another box. The biggest problem though would be moving around in the box, as `cd ..` wouldn't take you back to your local machine. What do you think?
Show HN: ssh and cd get married
41–50 of 51 posts
Re: Show HN: ssh and cd get married
#42Re: Show HN: ssh and cd get married
#43Alternatively, you could keep a tmux session open on the server and just attach it on connect. That way you can have everything arranged just the way you left it on disconnect. Same applications running, multiple windows, splits, etc. And you don't even need to start a new shell on connect. ssh user@host -t tmux attach You can add an alias for it. alias backtowork='ssh -t user@host tmux attach -t worksession' The las…
Re: Show HN: ssh and cd get married
#44If you are an Emacs user, Tramp does this, e.g. you can open a file like: /user@example.com:/some/remote/path/file.dat Directory navigation (dired) works too, you can also open a shell in the remote directory (M-x shell)
Re: Show HN: ssh and cd get married
#45t=${@[$#]}
c=("ssh" "-t" "${@:1:$(( $# -1 ))}" "${t%:}" "cd ${t##:}; \$SHELL -l")
"${c[@]}"
Re: Show HN: ssh and cd get married
#46Any benefits with this over running something like this? Other than it being shorter and easier for someone not familiar with console commands? ssh -t yourserver.com 'cd /some/dir/;exec /bin/sh'
Re: Show HN: ssh and cd get married
#47Any benefits with this over running something like this? Other than it being shorter and easier for someone not familiar with console commands? ssh -t yourserver.com 'cd /some/dir/;exec /bin/sh'
I didn't develop this because the keystrokes were difficult, I just know that both git and SCP support this syntax and couldn't think of any good reason why SSH shouldn't.
Re: Show HN: ssh and cd get married
#48What shell and theme is he using?
Re: Show HN: ssh and cd get married
#49Alternatively, you could keep a tmux session open on the server and just attach it on connect. That way you can have everything arranged just the way you left it on disconnect. Same applications running, multiple windows, splits, etc. And you don't even need to start a new shell on connect. ssh user@host -t tmux attach You can add an alias for it. alias backtowork='ssh -t user@host tmux attach -t worksession' The las…
I use Byobu on top of that for some extra useful features. http://byobu.co/about.html
Re: Show HN: ssh and cd get married
#50Earlier quoted context omitted.
I use Byobu on top of that for some extra useful features. http://byobu.co/about.html
I've looked through the docs and a video on YouTube and I still can't figure it out – what features does this offer that can't already be done with tmux?
The next is all the handy notifications in the bottom bar; a bit like conky, if you use that. So it lists the server mem/cpu/network load, number of packages that need updating, RAID status, AWS estimated cost (if relevant), no. logged in users, etc...
It originally started out with a Screen backend, then switched over to Tmux which has a lot of the same multiplexing functionality. So that's probably why you're not seeing a huge added benefit. But the added extras are enough to make me always want Byobu installed - particularly the easy session attachment.