SIZE(1)

πŸ“¦ version 2.45, in ubuntu questing

πŸŽ€ SIZE(1) Β· GNU Development Tools πŸŽ€

πŸ¦‹ NAME πŸ¦‹

size - list section sizes and total size of binary files ✨

🌸 SYNOPSIS 🌸

size [-A|-B|-G|--format=compatibility]
     [--help]
     [-d|-o|-x|--radix=number]
     [--common]
     [-t|--totals]
     [--target=bfdname] [-V|--version]
     [-f]
     [objfile...]

πŸ’… DESCRIPTION πŸ’…

okay so the GNU size utility lists the section sizes and the total size for each of the binary files objfile on its argument list πŸ”₯ by default you get one line of output per file, or per module if the file is an archive.

objfile... are the files to be examined. if you don't name any, it'll just grab the file "a.out" instead 🧚

✨ OPTIONS ✨

the command-line options have the following meanings, bestie πŸ’–

  • -A, -B, -G, --format=compatibility β€” this is where you pick the vibe of the output πŸŽ€ -A (or --format=sysv) makes it look like System V size, -B (or --format=berkeley) makes it look like Berkeley size, and -G (or --format=gnu) gives you GNU format, which is similar to Berkeley but the sizes are counted differently πŸ‘‘ the default is the one-line format that's similar to Berkeley's.

here's the Berkeley (default) format, which is giving classic πŸ“:

$ size --format=Berkeley ranlib size
   text    data     bss     dec     hex filename
 294880   81920   11592  388392   5ed28 ranlib
 294880   81920   11888  388688   5ee50 size

okay so Berkeley style counts read only data in the "text" column, not in "data" πŸ™ˆ the "dec" and "hex" columns both show the sum of "text", "data", and "bss", in decimal and hexadecimal respectively.

GNU format is the other flavour 🌈 it counts read only data in the "data" column, not "text", and it only shows the sum of "text", "data", and "bss" once, in the "total" column. you can use the --radix option to change the number base for all columns. same data, GNU conventions:

      text       data        bss      total filename
    279880      96920      11592     388392 ranlib
    279880      96920      11888     388688 size

and this is the same data again, but closer to System V conventions πŸ’œ

$ size --format=SysV ranlib size
ranlib  :
section         size         addr
.text         294880         8192
.data          81920       303104
.bss           11592       385024
Total         388392

size  :
section         size         addr
.text         294880         8192
.data          81920       303104
.bss           11888       385024
Total         388688
  • --help, -h, -H, -? β€” show a summary of acceptable arguments and options 🧚
  • -d, -o, -x, --radix=number β€” control whether each section's size shows up in decimal (-d or --radix=10), octal (-o or --radix=8), or hexadecimal (-x or --radix=16) πŸ“ with --radix=number, only the three values (8, 10, 16) are supported. the total size is always shown in two radices: decimal and hexadecimal for -d or -x output, or octal and hexadecimal if you're using -o.
  • --common β€” prints the total size of common symbols in each file. with Berkeley or GNU format, these get included in the bss size 🫢
  • -t, --totals β€” shows totals of all objects listed (Berkeley or GNU format mode only) πŸ’–
  • --target=bfdname β€” tells size that the object-code format for objfile is bfdname. this might not be necessary, since size can automatically recognise lots of formats πŸ¦‹
  • -v, -V, --version β€” displays the version number of size ✨
  • -f β€” ignored πŸ’€ other versions of size use this one, but the GNU Binutils version doesn't support it.
  • @file β€” reads command-line options from file πŸŽ€ the options read are inserted in place of the original @file option. if file doesn't exist or can't be read, the option gets treated literally and isn't removed.

options inside file are separated by whitespace. to include a whitespace character in an option, wrap the entire option in single or double quotes. any character (including a backslash) can be included by putting a backslash in front of it. the file can also have its own @file options, and those get processed recursively 🌸

πŸ¦‹ SEE ALSO πŸ¦‹

ar(1), objdump(1), readelf(1), and the Info entries for binutils πŸ“š

Copyright (c) 1991-2025 Free Software Foundation, Inc. ⭐

permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. a copy of the license is included in the section entitled "GNU Free Documentation License".


okay bestie that's the whole tea 🫢 this page was brought to you by binutils-2.45, dated 2025-12-03, filed under SIZE(1) πŸ’…βœ¨

πŸ“¦ where this page comes from