EDUCBA

EDUCBA

MENUMENU
  • Free Tutorials
  • Free Courses
  • Certification Courses
  • 600+ Courses All in One Bundle
  • Login

Linux Size

By Priya PedamkarPriya Pedamkar

Home » Software Development » Software Development Tutorials » Linux Tutorial » Linux Size

Linux Size

Definition of Linux Size

The size command in Linux will allow to list the section size and the total size of the object files or the archived files in its argument list. When we do not specify the object file in the parameter list, then by default, ‘a.out’ file is used. In this tutorial, we will discuss its syntax, how to size command is used in Linux, its options, and their usages with different examples.

Syntax of size command in Linux:

Start Your Free Software Development Course

Web development, programming languages, Software testing & others

We can use size command in Linux in a different format with different options as shown below:

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

How Does Size Command Work in Linux?

Size command in Linux can be used in different ways with its options. Below are the options that can be used with the size command in Linux along with its description.

Options Description
-A|-B     –format={sysv|berkeley} We can select the output style by mentioning the format either in SysV or Berkeley. By default, if no format is mentioned then it takes Berkeley.
-o|-d|-x  –radix={8|10|16} To display the numbers in order of octal, decimal or hex.
-t        –totals To print the total size for Berkeley format only.
–common To print the total size of *COM* syms
–target=<bfdname>  To set the binary object file format
@<file>  To scan the options from object-file
-h        –help To display the list of options available in size command.
-v        –version To display the version of the program.

Examples of Linux Size Command

Following are the examples are given below:

1. To Get the Default Size Output

The size command will display the output that will give you information on size command in 5 values like data, text, dec, bss, and hex as given below.

Syntax:

size directory_name

Example:

size /usr/var/log

Linux Size-1.1

The above result is in Berkeley format and we can also get the same output in three different commands as shown below:

Linux Size-1.2

2. Default File Option

When there is no file name passed in the argument, then a.out file is used as deafult file name as shown below. In the current directory, it will check for ‘a.out’ file and will calculate the size and it will display the result in Berkeley format.

Popular Course in this category
Linux Training Program (16 Courses, 3+ Projects)16 Online Courses | 3 Hands-on Projects | 160+ Hours | Verifiable Certificate of Completion | Lifetime Access
4.5 (6,008 ratings)
Course Price

View Course

Related Courses
Kali Linux Training (3 Courses, 3+ Projects)Red Hat Linux Training Program (4 Courses, 1+ Projects)

Syntax:

size

Example:

size

Linux Size-1.3

3. To Get the Output in SysV Format

The output when generated in SysV format, it will print different sections along with the size and address of each section name.

Syntax:

size –format=SysV dir_name

Example:

size --format=SysV /usr/var/log

Linux Size-1.4

4. To Specify the Output Value in Decimal

When we pass the option ‘-d’ with the argument list, then we will get the result in decimal value format as given in the below example.

Syntax:

size -d dir_name

Example:

size -d /usr/var/log

Linux Size-1.5

5. To Specify the Output Value in Octal Format

When we pass the option ‘-o’ with the argument list, then we will get the result in octal value format as given in below example.

Syntax:

size -o dir_name

Example:

size -o /usr/var/log

Linux Size-1.6

6. To Specify the Output Value in Hex Format

When we pass the option ‘-x’ with the argument list, then we will get the result in hex value format as given in below example.

Syntax:

size -x dir_name

Example:

size -x /usr/var/log

Linux Size-1.7

7. Option –radix

Radix option in size command is used to specify the format number instead of using decimal, hex or octal. For decimal, we can use the number format as –radix=10.

Syntax:

size –radix=10 /dir_name

Example:

size --radix=10 /usr/var/log

Linux Size-1.8

  • Radix option in size command is used to specify the format number instead of using decimal, hex, or octal. For decimal, we can use the number format as –radix=10.

Syntax:

size –radix=10 /dir_name

Example:

  • Radix option in size command is used to specify the format number instead of using decimal, hex or octal. For octal, we can use the number format as –radix=8.

Syntax:

size –radix=8 /dir_name

Example:

size -o /usr/var/log

Linux Size-1.9

  • Radix option in size command is used to specify the format number instead of using decimal, hex or octal. For hex, we can use the number format as –radix=16.

Syntax:

size --radix=16 /dir_name

Example:

size --radix=16 /usr/var/log

Output-1.10

We can use only format numbers as 10,8,16 for decimal, octal, and hex respectively. When we use any other format numbers, then we will get an error saying “Invalid radix”. Below is an example for an invalid radix format.

size --redix=12 /usr/var/log

Output-1.11

8. To Display the Common Symbol Count

The common option allows printing the total number of all common symbol that is present in the object file. By default, the format will take Berkeley file format, this will also be used to include in the value for column “bss”.

Syntax:

size -A --common /dir_name

Example:

size -A --common /usr/var/log

Output-1.12

Option -A is used for SysV format. In the above example, the last line having *COM* will give the value.

9. To Display the Total in Berkeley Format

The option -t (or –totals) allows in displaying the new line at the end of the result that will print the value of all the object files that are in the list. The result that would be produced in using -t option is shown as below.

Syntax:

size -t /dir_name

Example:

size -t /usr/var/lo*

Output 1.13

Conclusion

The size command in Linux is a very important command that will allow to list the section size and the total size of the object files or the archived files in its argument list. When we do not specify the object file in the parameter list, then by default, ‘a.out’ file is used. Different formats are used in displaying the output formats like decimal, octal, or hex. Options with examples are also explained in the above tutorial for better understanding.

Recommended Articles

This is a guide to Linux Size. Here we also discuss the definition and how does size command work in linux? along with different examples and its code implementation. You may also have a look at the following articles to learn more –

  1. Linux Kill Signals
  2. Linux Watch Command
  3. Linux Split Command
  4. Linux Container

Linux Training Program (16 Courses, 3+ Projects)

16 Online Courses

3 Hands-on Projects

160+ Hours

Verifiable Certificate of Completion

Lifetime Access

Learn More

0 Shares
Share
Tweet
Share
Primary Sidebar
Linux Tutorial
  • Linux Commands
    • CAT Command in Linux
    • PS command in Linux
    • Mkdir Command in Linux
    • rmdir command in Linux
    • mv command in Linux
    • Linux rm Command
    • CHMOD Command in Linux
    • Zip Command in Linux
    • Linux Route Command
    • SCP Command in Linux
    • du Command in Linux
    • Less Command in Linux
    • Copy Command in Linux
    • Head Command in Linux
    • Help Command in Linux
    • Linux History Command
    • hostname Command in Linux
    • GREP Command in Linux
    • Linux Curl Command
    • Linux List Users
    • Linux List Directories
    • Linux Directory Permissions
    • Find Directory Linux
    • Linux User Permission
    • Linux Add User
    • Linux Delete User
    • Linux uniq
    • Linux Filter Commands
    • Linux sort Command
    • Linux Sort by Size
    • Remove dir Linux
    • Linux tr Command
    • Linux Touch Command
    • Linux More Command
    • Linux Cal Command
    • Linux OD
    • Linux Zcat
    • Linux tracepath
    • Linux Sleep
    • Linux bg Command
    • Linux WC
    • Linux Read
    • Linux Write
    • Linux Rename Command
    • Linux Free Command
    • Linux tac
    • Linux Shred
    • Linux wget
    • Linux Date
    • Linux Untar
    • Linux JQ
    • Linux Xargs
    • Linux Mount Command
    • Linux mdadm
    • Linux comm
    • Linux tee Command
    • Tail Command in Linux
    • Linux gzip
    • Linux Directory Structure
    • Linux Alias Command
    • Linux Inode
    • Linux Ping
    • Linux Watch Command
    • Linux Split Command
    • Linux Size
    • Linux Network Stack
    • Linux Diff Command
    • Vim Command in Linux
    • Linux nslookup
  • Basic
    • Introduction to Linux
    • What is Linux
    • Careers in Linux
    • How to Install Linux
    • How to Install Ubuntu
    • How to Install Ubuntu Server
    • How To Install Debian
    • Advantage Of Linux
    • What is Raid in Linux
    • What is Raid 5?
    • Raid 5 vs Raid 6
    • Careers in Linux Administration
    • What is Shell in Linux?
    • Bash Shell in Linux
    • Linux Emulator
    • Linux Operators
    • Linux Apps
    • Linux Keyboard Shortcuts
    • Linux Crontab
    • What is Raid Storage
    • What is Vmware
    • What is RedHat
    • What is Debian
    • Uses of Ubuntu
    • Career In RedHat
    • Linux Distributions
    • Linux From Scratch
    • Linux Format
    • Cheat Sheet Linux
  • Advanced
    • Install VMware
    • Install GRUB
    • Chown Command in Linux
    • Linux Network Command
    • Configuring Linux Network Environment
    • DNS Configuration in Linux
    • Linux Users
    • Create User in Linux
    • DHCP Server in Linux
    • FTP Server in Linux
    • Linux Regular Expression
    • IP Command in Linux
    • Set IP Address in Linux
    • Tar Command in Linux
    • Dynamic Host Configuration Protocol
    • Linux Kill Signals
    • Linux File Permissions
    • Linux File System
    • Linux Create File
    • Linux Concatenate Files
    • Linux Join
    • Linux Process Management
    • Linux Proxy Server
    • Linux System Commands
    • Linux System Logging
    • NFS in Linux
    • Linux LVM
    • Linux Repository
    • Samba Server in Linux
    • Top Commands in Linux
    • Types of Shells in Linux
    • Shell Script Types For Linux
    • GCC Command in Linux
    • Monolithic Kernel
    • YARN Package Manager
    • Linux Sed Replace
    • Linux List Groups
    • Linux Container
    • Linux Find File by Name
    • Create Folder in Linux
    • Linux Move Folder
    • Linux Error Codes
    • Linux Automount
    • Linux HugePages
  • Kali Linux
    • Install Kali Linux
    • Kali Linux Uses
    • Kali Linux Commands
    • Kali Linux Repository
    • Kali Linux Packages
    • Kali Linux root password
    • Kali Linux Alternative
  • Interview Questions
    • Linux Interview Questions
    • Linux System Administration Interview
    • Red Hat Interview Questions

Related Courses

Kali Linux Training

Linux Training Course

Red Hat Training Course

Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Corporate Training
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Java Tutorials
  • Python Tutorials
  • All Tutorials
Certification Courses
  • All Courses
  • Software Development Course - All in One Bundle
  • Become a Python Developer
  • Java Course
  • Become a Selenium Automation Tester
  • Become an IoT Developer
  • ASP.NET Course
  • VB.NET Course
  • PHP Course

© 2020 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA Login

Forgot Password?

EDUCBA
Free Software Development Course

Web development, programming languages, Software testing & others

*Please provide your correct email id. Login details for this Free course will be emailed to you
Book Your One Instructor : One Learner Free Class

Let’s Get Started

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA
Free Software Development Course

Web development, programming languages, Software testing & others

*Please provide your correct email id. Login details for this Free course will be emailed to you

Special Offer - Linux Training Program (16 Courses, 3+ Projects) Learn More