4 ms·
Ask HN: Why can't you "put" files through ssh?
I hate having to have one terminal with ssh running and one terminal with sftp running (especially when sftp doesn't have tab completion or any of the other handly shell shortcuts). Am I doing something wrong?
- brk 17y agoWhy not use scp? Although, I'm not 100% sure what you're trying to accomplish.
- noaharc 17y agoWell, from the man pages, it looks like this still requires another terminal besides my ssh terminal (plus a lot of typing), so it's pretty much the same setup as using sftp, right? I just don't see why I can't type "put filename" in ssh like you can in sftp. That really seems like a pleasurable user experience. This really became a pain point for me last week, when I was testing a lot of code on remote machines. I want to be able to manipulate them with ssh, but I also want to be able to transfer my local copies easily.
- buugs 17y agoI think screen (using ssh and scp) is your best solution to only using one terminal and lets face it ctrl+key n is very easy to do.
- lann 17y agoYou can scp from a remote host to the host you're currently logged into (assuming no firewall restrictions). You could even simulate the put command with a sufficiently clever shell script by using the value of SSH_CLIENT or _CONNECTION. To sweeten the deal, some shells (zsh at least) will even do tab-completion for remote scp paths. Aside from that, I don't think I could function without multiple terminals. I usually have 6-7 open, minimum.
- trevelyan 17y agoIf you're in SSH you're executing commands on the remote machine. What you're suggesting would require a subset of commands to run on your machine, and a subset of commands to run on the remote machine. As everyone else suggests, just use scp. You can always tunnel into your own computer from the remote machine to fetch any files you need.
- tumult 17y agoYou can do SCP. There are also various shell scripts that actually let you pipe data over.
- kngspook 17y agoIn addition to all the scp comments here, if I'm doing a constant <edit files locally, update remote copy of directory, test on remote> cycle; I'll usually use rsync instead of scp.