I have a remote host called myhost and I have some log files that I want to access in the terminal.

For example, I can access this in my browser:


But when I try this in the terminal

scp -p "username@myhost:/f$/logs/dev.log" "/home/Documents"

it gives me the 'cannot stat' error:

cp: cannot stat `username@myhost:/f$/logs/dev.log': No such file or directory

I have tried using username@file://myhost and username@//myhost but still no luck.

Any ideas?

Thanks in advance!

  • 3
    Were exactly is the file stored on your remote host (from /)? Just because it's in myhost/f$/logs/dev.log in your browser does not mean it's in the same spot relative to user-login. Second question is, can you ssh in fine? – nerdwaller Oct 30 '12 at 15:46
  • Your error message says `username@myhost:/f$/logs/dev.lo' (note missing g at the end). Is that a typo in the error message or the cause of your problem? – Dennis Oct 30 '12 at 16:01
  • The remote host is another machine shared within the network. And yes I can ssh into the machine using the same username but it is strongly not recommended. So maybe that's the problem here? – John Powel Oct 30 '12 at 16:02
  • @Dennis, good eyes! But that's just a typo. Thanks! – John Powel Oct 30 '12 at 16:03
  • When you logon with ssh, is it in /f$/logs/dev.log or is it in /_<homedir>_/f$/logs/dev.log? – BenjiWiebe Oct 30 '12 at 16:06

Let me clarify the solution using wget:

Since I can use the URL to access the file, I simply use this line in my batch:

wget -q //myhost/f$/logs/dev.log -Y off

where "-q" means:

Turn on verbose output, with all the available data. The default output is verbose.

and "-Y" means:

Turn proxy on or off

This will download the file in the current directories and it solves my problem.

Reference: http://www.gnu.org/software/wget/manual/wget.html

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.