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

link|improve this question

71% accept rate
feedback

1 Answer

up vote 1 down vote accepted

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.

link|improve this answer
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 '10 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 '10 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 '10 at 21:47
If you are the owner of the file, you should have write access to it already. – dmah Nov 24 '10 at 21:48
Oh whoops I had + instead of -. Yeah now I get an error "Operation not permitted". – mark Nov 24 '10 at 21:49
show 2 more comments
feedback

Your Answer

 
or
required, but never shown

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