Your Question: Which Command Shows the File Size in Bytes in Linux?
Contents

–l – displays a list of files and directories in long format and shows the sizes in bytes.

How do I check the size of a file in Unix bytes?

Getting file size using find command

find “/etc/passwd” -printf “%s” find “/etc/passwd” -printf “%sn” fileName=”/etc/hosts” mysize=$(find “$fileName” -printf “%s”) printf “File %s size = %dn” $fileName $mysize echo “${fileName} size is ${mysize} bytes.”

How do I tell the size of a file?

How to do it: If it’s a file in a folder, change the view to Details and look at the size. If not, try right-clicking on it and selecting Properties. You should see a size measured in KB, MB or GB.

James H. Sterling

James H. Sterling

Environmental Science & Climate Journalist

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.

Share this article
Twitter Facebook Pinterest