Formatting pwd/ls for use with scp
Posted
by
eumiro
on Super User
See other posts from Super User
or by eumiro
Published on 2012-06-11T08:00:08Z
Indexed on
2012/06/11
10:42 UTC
Read the original article
Hit count: 226
I have two terminal windows with bash
. One is local on the client
computer, another one has an SSH-session on the server
. On the server
, I am in a directory and seeing a file I would like to copy to my client
using scp from the client
.
On the server
I see:
user@server:/path$ ls filename
filename
I can now type scp
in the client
shell, select and copy the user@server:/path
from the server
shell and paste to the client
shell, then type slash and copy and paste the filename
and append a dot to get:
user@client:~$ scp user@server:/path/filename .
to scp
a file from the server
to the client
.
Now I am searching for a command on the server
, that would work like this:
user@server:/path$ special_ls filename
user@server:/path/filename
which would give me the complete scp-ready string to copy&paste to the client
shell.
Something in the form
echo $USER@$HOSTNAME:${pwd}/$filename
working with relative/absolute paths.
Is there any such command/switch combination or do I have to hack it myself?
Thank you very much.
© Super User or respective owner