0

I am connected to a remote mac via terminal (did ssh machinename). I am looking at a file that I want to replace with a file from my local machine. Something like:

$ ls
   foo/  grok/  target.txt

so I want to replace "target.txt" with a target.txt that lives on my own machine. How do I do that?

Thanks

1 Answer 1

1

You could use scp to copy it over. You could edit the file on the remote system and copy and paste from your local copy.

6
  • Ah ok, I just realized, I could use vi to edit the file in-place (that'll be much easier). The file seems to be in read-only mode, can I put it in write-mode temporarily to edit it?
    – mark
    Nov 24, 2010 at 21:28
  • Assuming that you own the file, chmod u+w target.txt to edit and then chmod u-w target.txt to set it read-only.
    – dmah
    Nov 24, 2010 at 21:42
  • Yeah right now the file has the following permission: "-rw-r--r--" but when I try "chmod u+w target.txt", I get no error, but the permission remains the same.
    – mark
    Nov 24, 2010 at 21:47
  • If you are the owner of the file, you should have write access to it already.
    – dmah
    Nov 24, 2010 at 21:48
  • Oh whoops I had + instead of -. Yeah now I get an error "Operation not permitted".
    – mark
    Nov 24, 2010 at 21:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .