How To Get Size Of a File In Linux?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The easiest way to get the size of a file in Linux is to use the du command. This command can be used to determine the size of a file or a directory. To get the size of a single file, use the -b option. For example, to get the size of a file named example.txt, use the command:
$ du -b example.txt
The output will be the size of the file in bytes. To get the size of a directory, use the -s optio. For example, to get the size of the /etc directory, use the command:
$ du -s /etc
The output will be the size of the directory in bytes.