As you begin spending increasingly more time engaged on the Linux command line, you are inclined to study utilities that are not very often used. As soon as such device is sum, which solely affords two options: show checksum and block rely for enter recordsdata. On this brief tutorial, we are going to shortly focus on the fundamentals of sum utilizing some straightforward to grasp examples.

However earlier than we try this, it is value mentioning that each one examples on this tutorial have been examined on an Ubuntu 16.04 LTS machine.

Linux sum command

As already talked about above, the sum command provides you details about file checksum and the variety of blocks a file is comprised of. Following is its syntax:

sum [OPTION]… [FILE]…

And here is how the device’s man web page defines it:

Print checksum and block counts for every FILE.

Following are some Q&A-styled examples that ought to offer you a good suggestion on how the device works.

Q1. Find out how to use sum command?

Fundamental utilization is pretty straightforward – simply move an enter file to the command. For instance:

sum file1

And here is the output the command produced on my system:

54333     1

The primary entry is the checksum and the second is the block rely for the file

Q2. Find out how to make sum settle for enter from STDIN?

For this, all you must do is to run the sum command with none enter.


As you press enter, the command will wait so that you can present enter.

How to make sum accept input from STDIN

As soon as the enter file title is supplied, simply press ctrl+d, and you will get the output.

sum command processes  input file

Q3. Find out how to change algorithm sum makes use of?

The device affords two choices: -r and -s. The previous permits BSD sum algorithm, whereas the latter tells sum to make use of System V algo. Additionally, with -r, sum makes use of 1k block, whereas with -s, it makes use of 512 bytes blocks.

Here is an instance:

How to change algorithm sum uses

To know extra about sum, you need to use the usual –help and –version choices. The previous shows the whole assist information, whereas the latter outputs the device’s model info.


As you’ll have noticed, the sum command may be very straightforward to grasp and use – the training curve may be very low. We have mentioned nearly all command line possibility the device affords. To study extra about Sum, head to its man web page.

How To Set up Linux, Nginx, MySQL, PHP (LEMP stack) on Ubuntu 18.04

Previous article

9 Free Open Supply Flipping Clocks Utilizing CSS and JavaScript

Next article

You may also like


Leave a Reply

More in Linux