Live data from Hacker News

Show HN: ssh and cd get married

github.com

41–50 of 51 posts

Re: Show HN: ssh and cd get married

#41
post #23

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?

Take a look at https://github.com/spencertipping/cd. It will let you cd to local or remote machines the same way, and will take you back to your local machine on "cd ..". (It mounts the remote fs instead of SSHing there.)

Re: Show HN: ssh and cd get married

#43

Alternatively, 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

#44
post #4

If 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)

+1 also from within eshell cd proto:user@location:/filepath where proto can be ftp, ssh , and some others

Re: Show HN: ssh and cd get married

#47

Any 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'

Nope, that's actually very close to what it does.

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

#49
post #43

Alternatively, 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

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?

Re: Show HN: ssh and cd get married

#50
post #43

Earlier 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?

There are two major things for me: The first is the easy attachment to existing tmux sessions, ie. I just ssh to a server and it'll re-attach to my last tmux session automatically - F6 then detaches cleanly and logs out.

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.

Post reply on HN