Knowing how to check the size of a file in UNIX is a fundamental task for managing and organizing files in a UNIX-based system. UNIX provides several commands that allow users to obtain file size information, each with its own advantages and use cases.
One of the most commonly used commands to check file size is the “ls” command. The “ls” command lists files and directories in a specified directory, and by default, it displays the file size in bytes. For example, the following command lists the files in the current directory and displays their sizes: