2018-11-15 13:36:14 +00:00
|
|
|
---
|
|
|
|
layout: page
|
|
|
|
category-page: intermediate
|
2018-11-16 12:47:48 +00:00
|
|
|
category-title: Intermediate commands
|
2018-11-15 13:36:14 +00:00
|
|
|
tags: sha sums check
|
|
|
|
author: Gianmarco De Vita
|
|
|
|
title: shasum
|
2018-11-18 20:38:56 +00:00
|
|
|
previous-page: pages/cmd/interm/scp.html
|
|
|
|
next-page: pages/cmd/interm/ssh.html
|
2018-11-15 13:36:14 +00:00
|
|
|
---
|
2018-11-15 20:09:21 +00:00
|
|
|
|
2018-11-15 13:36:14 +00:00
|
|
|
With <code>shasum</code> command you can work with SHA Checksums.
|
|
|
|
|
|
|
|
<pre>
|
|
|
|
shasum [flag] [file]
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
<h3>Store the Checksum</h3>
|
|
|
|
|
|
|
|
You can store the output in a file by adding to the command line the string
|
2018-11-15 20:09:21 +00:00
|
|
|
output symbol ">" and then the path and the name of the file.<br>
|
2018-11-15 13:36:14 +00:00
|
|
|
|
|
|
|
<h3>Define the algorithm</h3>
|
2018-11-15 20:09:21 +00:00
|
|
|
|
2018-11-15 13:36:14 +00:00
|
|
|
The flag <code>-a</code> allows you to choose which algorithm to use when
|
2018-11-15 20:09:21 +00:00
|
|
|
defining the checksum of a file. The default algorithm is 1.
|
2018-11-15 13:36:14 +00:00
|
|
|
|
|
|
|
<pre>
|
|
|
|
shasum -a algorithm file
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
<h3>Read in binary mode</h3>
|
2018-11-15 20:09:21 +00:00
|
|
|
|
2018-11-15 13:36:14 +00:00
|
|
|
The flag <code>-b</code> allows you to read files in binary mode.
|
|
|
|
|
|
|
|
<pre>
|
2018-11-15 20:09:21 +00:00
|
|
|
shasum -b file.bin
|
2018-11-15 13:36:14 +00:00
|
|
|
</pre>
|
|
|
|
|
|
|
|
<h3>Check two SHA sums</h3>
|
2018-11-15 20:09:21 +00:00
|
|
|
|
2018-11-15 13:36:14 +00:00
|
|
|
You can verify wheter two checksums belong to the same file or not (and so
|
2018-11-15 20:09:21 +00:00
|
|
|
define wheter the two files are the same thing) wit the flag <code>-c</code>.
|
|
|
|
After storing the Checksums into two files (let say file1 and file2),
|
|
|
|
you can write to command as follows:
|
2018-11-15 13:36:14 +00:00
|
|
|
|
|
|
|
<pre>
|
2018-11-15 20:09:21 +00:00
|
|
|
shasum -c shaSum1 shaSum2
|
2018-11-15 13:36:14 +00:00
|
|
|
</pre>
|
|
|
|
|
|
|
|
<h3>Display help</h3>
|
2018-11-15 20:09:21 +00:00
|
|
|
|
2018-11-15 13:36:14 +00:00
|
|
|
Writing the command followed by the <code>-h</code> h flag will display a little
|
2018-11-15 20:09:21 +00:00
|
|
|
help paragraph with the main functions of this command.
|
2018-11-15 13:36:14 +00:00
|
|
|
|
|
|
|
<pre>
|
|
|
|
shasum -h
|
|
|
|
</pre>
|