0

Is there a way I could get the md5 hash of a file on a remote server?

I'm looking for a command like

md5 hlin117@server:/path/to/file.txt
5

AFAIK there is no remote md5.

The closest you can get is to execute the command on the remote server:

ssh hlin117@server md5sum /path/to/file.txt

Obviously, md5sum must be installed on the remote server.

Alternatively, get the file and do it locally:

scp hlin117@server:/path/to/file.txt .
md5sum file.txt
rm file.txt

Or, as @Cyrus pointed out:

ssh hlin117@server cat /path/to/file.txt | md5sum
  • Thanks! Your first solution worked. (PS: I wanted to get the md5 hash sum so I don't need to scp it locally.) – hlin117 Sep 25 '15 at 5:19
  • 1
    With a local md5sum: ssh hlin117@server cat /path/to/file.txt | md5sum – Cyrus Sep 25 '15 at 5:39

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.