Linux Commands Examples

A great documentation place for Linux commands


list section sizes and total size.

see also : ar - objdump - readelf


size [-A|-B|--format=compatibility]
[--target=bfdname] [-V|--version]

add an example, a script, a trick and tips

: email address (won't be displayed)
: name

Step 2

Thanks for this example ! - It will be moderated and published shortly.

Feel free to post other examples
Oops ! There is a tiny cockup. A damn 404 cockup. Please contact the loosy team who maintains and develops this wonderful site by clicking in the mighty feedback button on the side of the page. Say what happened. Thanks!



How can I change the amount and size of Linux ramdisks (/dev/ram0 - /dev/ram15)?

You should use tmpfs for that instead.

mount -t tmpfs -o size=10g none /mnt/point


Actual file size on mac os x

To see the total of just one specific folder use:

du -s /path_to/specific_folder/

To see to total of each folder in one specific folder use an asterisk:

du -s /path_to/specific_folder/*

If you don't own all of the files in those directories use sudo to be sure everything is counted.

Edit: Ah, I understand what you are asking now. You want:

du -sk /path_to/specific_folder/


Why are the sizes of 2 directories different if the data within the directories is identical? They are identical ext4 partitions and disks

The size reported by ls -l for a directory has no relationship with the cumulated size of files stored in it.

It is just, for most common file systems, the size in bytes that has been required to store the directory entries. This size grows by block size (eg: 4096, 8192, ...). How many entries can be stored in a block is file system dependent and vary also with entries filenames length.

When directory entries are removed, the directory size is unaffected to reduce fragmentation.

In your example, the external3 directory has 18 * 4096 blocks allocated while the external4 has 17 * 4096 blocks.

That just means the former stored once more files (or files with longer names) even while the directory contents are currently identical. No big deal.


Why does Windows occupy more disk space, compared to Linux?

It is a very difficult thing to say...

There isn't really one answer fits all, for Ubuntu, it is mainly because it installs a subset of tools plus every day ones. Anything you want extra is downloaded when you need it (Such as frameworks for other programs)...

Windows Vista and 7 on the other hand copy the whole contents of the DVD to the drive and any Windows components you want to install at a later date do not require the disk to be put in.

Again, this is a very awkward question... I am not exactly sure what to say! It can be also said that you can get string from two different companies with different widths, yet they can both tie knots...

If you are just curious, I would download Vlite so you can take out components and just have a play to see how small you can make Windows.


Delete Directories smaller than x

Try du -sk * | awk 'BEGIN { FS="\t" }; { if($1 < 1000) print $2 }' | grep '' -Z | xargs -0 -s 1024 rm -rf. Be careful with rm!


How to change the size of desktop/window fonts in Puppy Linux 4.1?

Not using Puppy, I wonder if this article has the answer :

Puppy 5 - Font size too small

menu / desktop / desktop settings / set global font size, change font size, restart X


How to increase VirtualBox virtual drive actual size?

If you want to add space to the guest, there's 2 places it needs done: First in the virtualization host itself (Virtualbox, in your case), then again inside the guest.

If you originally created the virtual drive as 4 GB, then later resized it to 8 GB, you'll need to do some work in the guest OS to have it makes use of the extra space. Right now it's as if you took a 4 GB partition and put it onto an 8 GB drive -- the partitions haven't changed, so the rest of the space is unallocated as far as the guest is concerned. You can either add a 2nd partition in the guest or use some utility to resize the partitions in the guest.


file size returned from ls - Linux vs OS X

Likely it's the file system. The command is probably reporting a value as the size on disk rather than the actual size, and since each machine may be using a different cluster size, you see different values. More on the topic in this question.

You can use tune2fs -l to see how your file system is currently configured.


Limit/rotation of ~/.xsession-errors?

You should realy try to solve the problems that cause the file to grow.


How can I find out the size of a swap partition?

The sizes are in kilobytes since swapon -s is equivalent to cat /proc/swaps.

If you want to see the combined swap space use free. It can sum and convert to, for example, megabytes: free -m.


The GNU size utility lists the section sizes---and the total size---for each of the object or archive files objfile in its argument list. By default, one line of output is generated for each object file or each module in an archive.

objfile... are the object files to be examined. If none are specified, the file "a.out" will be used.


The command line options have the following meanings:




Using one of these options, you can choose whether the output from GNU size resembles output from System V size (using -A, or --format=sysv), or Berkeley size (using -B, or --format=berkeley). The default is the one-line format similar to Berkeley’s.

Here is an example of the Berkeley (default) format of output from size:

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

This is the same data, but displayed 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


Show a summary of acceptable arguments and options.





Using one of these options, you can control whether the size of each section is given in decimal (-d, or --radix=10); octal (-o, or --radix=8); or hexadecimal (-x, or --radix=16). In --radix=number, only the three values (8, 10, 16) are supported. The total size is always given in two radices; decimal and hexadecimal for -d or -x output, or octal and hexadecimal if you’re using -o.


Print total size of common symbols in each file. When using Berkeley format these are included in the bss size.



Show totals of all objects listed (Berkeley format listing mode only).


Specify that the object-code format for objfile is bfdname. This option may not be necessary; size can automatically recognize many formats.



Display the version number of size.


Read command-line options from file. The options read are inserted in place of the original @file option. If file does not exist, or cannot be read, then the option will be treated literally, and not removed.

Options in file are separated by whitespace. A whitespace character may be included in an option by surrounding the entire option in either single or double quotes. Any character (including a backslash) may be included by prefixing the character to be included with a backslash. The file may itself contain additional @file options; any such options will be processed recursively.


Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 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".

see also

ar , objdump , readelf , and the Info entries for binutils.

How can this site be more helpful to YOU ?

give  feedback