• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

size Command Examples in Linux

by Deepika

“Size” is a command-line tool that is part of the GNU Binutils suite of software. Its purpose is to display information about the sizes of sections inside binary files. This can be useful for developers and system administrators who need to understand how the different parts of a binary file are organized and how much space they take up.

When a program is compiled, the compiler generates object files that contain the executable code, data, and other resources that make up the program. These object files are then linked together to create a single binary file that can be executed on the target system. The binary file is typically divided into sections, such as the text section (which contains the executable code) and the data section (which contains initialized and uninitialized data).

“Size” allows users to view the sizes of these sections, as well as other information about the binary file. The output of the “size” command typically includes the total size of the file, as well as the sizes of each section and the percentage of the file that each section occupies. This information can be used to identify areas of a program that may be consuming excessive amounts of memory or to optimize the layout of a program’s sections to improve performance.

size Command Examples

1. Display the size of sections in a given object or executable file:

# size path/to/file

2. Display the size of sections in a given object or executable file in [o]ctal:

# size -o|--radix=8 path/to/file

3. Display the size of sections in a given object or executable file in [d]ecimal:

# size -d|--radix=10 path/to/file

4. Display the size of sections in a given object or executable file in he[x]adecimal:

# size -x|--radix=16 path/to/file

Summary

In addition to displaying section sizes, “size” can also be used to display other information about a binary file, such as the symbol table and the relocation information. This can be useful for debugging and troubleshooting purposes, as it allows users to understand how the program is structured and how it interacts with other components of the system.

Overall, “size” is a powerful and flexible tool that can provide valuable insights into the structure and organization of binary files. Its ability to display section sizes, symbol tables, and other information makes it a valuable tool for developers and system administrators who need to understand how programs are built and executed.

Filed Under: Linux

Some more articles you might also be interested in …

  1. ag – The Silver Searcher. Like ack, but aims to be faster (Command Examples)
  2. How to Determine Which Process is Writing to Disk in Linux
  3. What are Bash Exit Codes in Linux
  4. gitlint Command Examples
  5. CentOS / RHEL 6 : How to Boot into single user mode
  6. slapt-get: command not found
  7. brctl: command not found
  8. How to Display Routing Table in Linux
  9. How to make alias command work in bash script or bashrc file
  10. rc-status: command not found

You May Also Like

Primary Sidebar

Recent Posts

  • glab Command Examples
  • “glab repo” Command Examples
  • “glab release” Command Examples
  • “glab pipeline” Command Examples

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright