cat command - will it overwrite?
cat ~/temp_minhakey.pub >> ~/.ssh/authorized_keys
appends the contents of ~/temp_minhakey.pub
to ~/.ssh/authorized_keys
, it does not overwrite it. This is safe.
You might be confused with a single >
which overwrites the file. The next command will overwrite your authorized_keys
file:
cat somefile > ~/.ssh/authorized_keys
The last part of that command has nothing to do with cat; the >> is a shell redirect that will always append to whatever target file you are specifying. If you used > instead, then it would overwrite the file.
There are several other shell redirects, and you will be more productive on a command line if you learn what they all are and when to use them:
http://www.gnu.org/software/bash/manual/bashref.html#Redirections