1

Apologies if this seems too basic or has been asked before (I didn't find an answer when I searched but this is also my first time using this website) but I'm a complete beginner who is using Unix for lab research work (in biology- I've never taken a computer science course in my life) at university and this is my literal third day using the system.

I need to save a .txt output file that I have on our server to my personal computer and I'm not sure how. I've seen some resources online already that said I could use the command scp but I'm not sure if that does the action I'm wanting (essentially saving the document to my desktop like you would do with a .doc on word) or how to make sure I'm directing it to the right place. These files are very large and take multiple days to run through all of the data so it's important that whatever command I use doesn't risk data loss so I don't ruin the data and have to start over. This is my best attempt at what I think the command should look something like-

scp myname@host:FileName.txt ~/Desktop/

However when I tried this my computer told me it couldn't find the file I had requested. Any advice? I'm not married to using the scp command either if that isn't the best way of doing it. I don't think I can download any additional programs to save the file for me so that isn't an option, but I do know there's a get command and I'm sure there's other ways too. It just feels really frustrating that I can't seem to figure out something so simple that there isn't a tutorial for it.

I'd really appreciate your feedback, thanks

1
  • Your command looks okay if FileName.txt is in the home directory of user myname. Otherwise you need to specify the path to the file, e.g. scp myname@host:/path/to/FileName.txt ~/Desktop/. – Freddy Nov 22 '20 at 2:42
0

I know it was quick, but a friend of mine who actually works with computers just happened to get back to me not long after I posted here. I thought I would put the answer so anybody who is having the same problem as me in the future could find it too. The code that worked for me looked like this:

scp myname@host:Directory/FileName.txt ~/Desktop/

Like Freddy said up above you need to specify the path. Because I'm new at this I didn't actually know what that meant I needed to do- if youre totally new like me it just means you need to list out all of the directories and other subfiles/folders your file is in so the computer can find it. In my case it was just in the directory without a bigger folder. If your file is in a folder, it should work as long as you just keep adding the folders to the line in the order you go through them with a slash in between. Also important is that apparently you're usually supposed to write the command this way-

scp myname@host:/Directory/FileName.txt ~/Desktop/

That didn't work for me. For some reason my computer liked it better without the first slash after the colon, but if that way doesn't work for you try it with the slash, or maybe someone can follow up and explain why it should/shouldn't have the slash. At this point I don't know enough to say why it is that way.

I also needed to log off of the server (ssh) I was on, which was the one that was hosting my file. I'm sure this is obvious to anyone who knows how these things work, but again for anyone that might need help in the future it has something to do with the way the computer will try to search for the file. If you're in the directory where the file is supposed to be, apparently that interferes with the computer's ability to go in there and find the file. (Again, I'm sure theres a better explaination for this, I just don't know it yet.)

Anyways thanks again! I know this might not have been the most important question but it was definitely a good learning experience for me, and I hope it can be a useful resource for someone else. I'm especially glad I found this site so I can come back to it in the future.

3
  • It is OK to answer your self. There is an option to do this at the same time as asking. Both the question and answer are posted at the same time. It is also encouraged in the help pages. – ctrl-alt-delor Nov 22 '20 at 10:29
  • With the slash it starts at the root (of the computer). Without it, it will start in the users home directory. – ctrl-alt-delor Nov 22 '20 at 10:31
  • Thanks! I will keep that in mind about the answering for the future, and now the slash makes more sense. – st013 Nov 24 '20 at 5:37
0

You already answered, but I will add some extra bits that may help.

On Unix a file is a file. The Operating System does not care what is in it (text, word-doc, spread-sheet, picture). It will just copy it, rename it, or what ever. It is the application programs that interpret what is in the file. Any program that has the job of copying, renaming, archiving, backing up, and that interprets or changes what is in a file, is buggy (and should not be used).

For the most part everything above that I said about Unix is also true of MS-Windows.

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.