sum command in Linux with Examples Last Updated : 14 Oct, 2024 Suggest changes Share Like Article Like Report The sum command in Linux is used to calculate the checksum and block count of files. This command helps in verifying file integrity by comparing the calculated checksum with an expected value. The sum command can operate on one or more files, and when no file is specified, it reads from standard input.SyntaxThe general syntax for the sum command is as follows:sum [OPTION]... [FILE]...Basic ExampleIt will ask for the input of the file we want to calculate the checksum. In the following example, we calculate the checksum for "myfile.txt".Key Options used with the sum command1. sum -r Uses the BSD algorithm, with 1K blocks. This is useful when working in environments that prefer BSD-style checksum algorithms. Example:sum -r myfile.txt2. sum -sUses the System V algorithm, with 512-byte blocks. This option is commonly used in older systems that rely on the System V algorithm.Example:sum -s myfile.txt 3. sum --helpDisplays help text with a list of all options and exits.Example:sum --help4. sum --versionShows version information of the sum command and exits.sum --versionOptionDescription-rUses the BSD algorithm with 1K blocks. Suitable for environments that rely on the BSD-style checksum.-sUses the System V algorithm with 512-byte blocks. Useful for older systems with the System V algorithm.--helpDisplays help text with a list of options.--versionShows the version information of the sum command.ConclusionThe sum command is a simple yet powerful tool for verifying file integrity in Linux systems. By using options such as -r and -s, you can choose different algorithms and block sizes based on your requirements. Whether you're verifying file downloads or automating checksum verification, sum is an essential command to know. R rahulkumarmandal Follow Article Tags : Linux-Unix linux-command Linux-file-commands Explore Linux/Unix Tutorial 10 min read Getting Started with LinuxWhat is Linux Operating System 10 min read LINUX Full Form - Lovable Intellect Not Using XP 2 min read Difference between Linux and Windows 7 min read What are Linux Distributions ? 8 min read Difference between Unix and Linux 5 min read Installation with LinuxHow to Install Arch Linux in VirtualBox? 7 min read Fedora Linux Operating System 12 min read How to install Ubuntu on VirtualBox? 6 min read How to Install Linux Mint? 3 min read How to Install Kali Linux on Windows? 2 min read How to Install Linux on Windows PowerShell Subsystem? 2 min read How to Find openSUSE Linux Version? 2 min read How to Install CentOS 2 min read Linux CommandsLinux Commands 15+ min read Essential Unix Commands 7 min read How to Find a File in Linux | Find Command 9 min read Linux File SystemLinux File System 12 min read Linux File Hierarchy Structure 6 min read Linux Directory Structure 6 min read Linux KernelLinux Kernel 4 min read Kernel in Operating System 3 min read How Linux Kernel Boots? 11 min read Difference between Operating System and Kernel 3 min read Linux Kernel Module Programming: Hello World Program 7 min read Linux Loadable Kernel Module 7 min read Loadable Kernel Module - Linux Device Driver Development 4 min read Linux Networking ToolsNetwork configuration and troubleshooting commands in Linux 5 min read How to configure network interfaces in CentOS? 5 min read Command-Line Tools and Utilities For Network Management in Linux 8 min read Linux - Network Monitoring Tools 4 min read Linux ProcessProcesses in Linux/Unix 6 min read How to Manage Process in Linux 4 min read Getting System and Process Information Using C Programming and Shell in Linux 2 min read Process states and Transitions in a UNIX Process 4 min read Linux FirewallLINUX Firewall 7 min read iptables command in Linux with Examples 7 min read How to Configure your Linux Firewall - 3 Methods 12 min read Shell Scripting & Bash ScriptingIntroduction to Linux Shell and Shell Scripting 8 min read What is Terminal, Console, Shell and Kernel? 5 min read How to Create a Shell Script in linux 7 min read Shell Scripting - Different types of Variables 4 min read Bash Scripting - Introduction to Bash and Bash Scripting 12 min read Bash Script - Define Bash Variables and its types 12 min read Shell Scripting - Shell Variables 6 min read Bash Script - Difference between Bash Script and Shell Script 4 min read Shell Scripting - Difference between Korn Shell and Bash shell 3 min read Shell Scripting - Interactive and Non-Interactive Shell 3 min read Shell Script to Show the Difference Between echo â$SHELLâ and echo â$SHELLâ 4 min read My Profile ${profileImgHtml} My Profile Edit Profile My Courses Join Community Transactions Logout Like