Welcome to WebmasterWorld Guest from

Forum Moderators: bakedjake

Message Too Old, No Replies

(tip) Easy way to scp files from remote server to laptop

Resolution of: Logged in host ip address?

4:00 am on Sep 11, 2006 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 27, 2001
votes: 0

This post is an extension to/resolution of a previous post:
Logged in host ip address? [webmasterworld.com]
I finally got a little function going that will scp a file to your home machine from the remote machine you're interacting with:

function scpme()
scp $1 username@${SSH_CLIENT% * *}:./$2

This goes in .bashrc and the usage is
scpme foo.txt
scpme foo.txt foo-othername.txt

On the same note you can easily set the display with:

alias displayon='export DISPLAY=${SSH_CLIENT% * *}:0.0'

The ${SSH_CLIENT% * *} gets just the IP part from the $SSH_CLIENT variable.