How do I determine the size of a file?

Question

How do I determine the size of a file?

Answer

Microsoft Windows users
MS-DOS users
Linux / Unix users

Microsoft Windows users

Below are the steps required for determining the size of a file or multiple files on computers that are running Microsoft Windows.

  1. Locate and highlight the file or files you wish to determine the size of.
  2. Right-click the file and click Properties.
  3. Within the file Properties you will be able to determine the size of the file or files you have highlighted.

or

  1. Open My Computer or Windows Explorer
  2. Make Windows display the file properties by clicking on View at the top of the Window and selecting Details. This will make your Explorer / My Computer display all your files, their sizes, type, and modified date.

or

  1. Open My Computer or Windows Explorer
  2. Move to the directory containing your file.
  3. If you wish to see the total space of the current directory, view the size of the directory in the right side of the status bar; otherwise, highlight the file you wish to view the size of and view the status bar.

In addition to the above steps, Windows users can also see the file sizes through MS-DOS using the steps shown below.

MS-DOS users

Below are the different methods a user can use to view the size of a file or files in MS-DOS.

  1. Move the the directory of the file you wish to view the size of.
  2. Once in the directory, perform one of the below commands.

    dir myfile.txt

    In the above example, if you wanted to see the size of the file "myfile.txt", you would type this command to see the size of that single file.

    dir *.txt

    If you needed to see how much space multiple files of a certain extension are, type the above command. In this case, it would display the space all txt files in the current directory are taking. Additional wildcard examples like the one above can be found on our wildcard definition.

Linux / Unix users

Below are some of the different methods a *nix user can use to determine a size of a file on their computer.

  1. Move the the directory of the file you wish to view the size of.
  2. Once in the directory, perform one of the below commands.

    ls -l help.html

    Performing the above command would list output similar to the below information.

    -rw-r----- 1 comphope www 11567230 Nov 24 01:12 log.txt

    In the above output example, the 11567230 is the size of the file. For a more user friendly output, use the du command as shown below.

    du -h log.txt

    This command would display the output "12M log.txt"

    If you wish to see the total size of multiple files, type a command similar to the below command.

    du -ch *.txt

    In the above example, the command would list every .txt file in the current directory, display the size of each of those files as it was listing the files, and the total of all the files combined.

Additional information

  • See the file definition for further information and related links.