On Linux there are so many essential commands to perform various tasks or install the applications. One of the essential commands is cksum command which you can use to display a CRC (Cyclic Redundancy Check) value, the byte size of the file to standard output. In this article how you can use the cksum command in Linux Mint.
How to Use cksum Command in Linux
You can follow the examples mentioned below to know how you can use cksum command in Linux:
To get the byte size and cksum of a text file execute the command by using the format given below:
For example, I have executed the command using the above format of the file named as example.txt:
Now edit the file to change the data inside it by using the format given below:
For example I have executed the command using the above format of the file named as example.txt to edit the data inside the file:
You can see the data of the file and can edit it according to your choice:
I edited the data from Hello World to Hello World12 and saved it:
Executing the given below cksum command you can check the byte size of the edited file:
You can see the amount of data and checksum have changed than that of the previous file.
You can use cksum command for two files by using the command format mentioned below:
Using the format given above I have executed the following command to check the amount of data and checksum for the files example1.txt example2.txt:
As you know the cat command is used to read the data from a file, so when you execute the command by using the format given below, it reads data from the file and give you the checksum and data size of the file:
I have used the example1.txt file to execute the command using the format given above:
When you execute the given below command on the command line terminal it will give you the option to write data of your choice:
After execution of the above command write anything you want and press Enter:
After that press Ctrl+ D and you will get the data size and checksum of the data you just wrote:
You can also use the find command and cksum command together to list all the files in any directory and output the CRC on all the files in that directory by executing the command mentioned below:
About cksum Command Line Tool
You can check the version of cksum tool by executing the command given below:
You can check get the help of cksum tool by executing the command given below:
You can know the Cyclic Redundancy Check and byte size of a file by using cksum command on Linux Mint. This is required to check when you are in doubt if your file has been corrupted while transferring. You can use the cksum command on Linux Mint by using the guide explained with examples in this article.