BASH: Getting the md5 hash of file on remote server
11,502
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
Related videos on Youtube
Author by
hlin117
Software Engineer at Uber Technologies. Previously student at the University of Illinois at Urbana-Champaign. Interests include Machine Learning Bioinformatics Mathematics
Updated on September 18, 2022Comments
-
hlin117 over 1 year
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
-
hlin117 over 8 yearsThanks! Your first solution worked. (PS: I wanted to get the md5 hash sum so I don't need to scp it locally.)
-
minorcaseDev over 8 yearsWith a local md5sum:
ssh hlin117@server cat /path/to/file.txt | md5sum