In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly describes how to quickly get started Linux size command, the article is very detailed, has a certain reference value, interested friends must read!
The size command is used to view the size of each segment and its sum in an object file, library, or executable file, and is a member of the GNU Binutils binary toolset.
Linux size command
The size command basically outputs the size of each segment of the specified input file and its sum. Here is the syntax for the command:
size [-A|-B|--format=compatibility] [--help] [-d|-o|-x|--radix=number] [--common] [-t|--totals] [--target=bfdname] [-V|--version] [objfile...]
The man page describes it this way:
❝
GNU's size program lists the segment size-and total size-of each object file or archive file in the parameter list. By default, one line of output is produced for each module in each target file or archive.
objfile…is the target file to be checked. If not specified, the default is file a.out.
Here are some examples of Q & A styles that I hope will give you an idea of the size command.
Q1: How to use the size command?
The basic usage of size is simple. All you need to do is input the name of the object/executable file. Here is an example:
size apl
The output of this command in my system is as follows:
How to use size command
The first three sections are text, data, and bss sections and their corresponding sizes. Then there is the total size in decimal format and hexadecimal format. Finally, the file name.
Q2. How to switch between different output formats?
According to the man page, the default output format for size is similar to Berkeley's format. However, you can also use the System V specification if you want. To do this, you can use the-format option plus the SysV value.
size apl --``format``=SysV
Here is its output:
How to switch between different output formats
Q3. How to switch to other units?
By default, segment sizes are displayed in decimal. However, you can also use octal or hexadecimal notation if you want. The corresponding command-line arguments are o and-x.
How to switch between different size units
For these parameters, the man page says:
❝
-d
-o
-x
–radix=number
Using these options, you can have the size of each segment displayed as decimal (-d or-radix 10), octal (-o or-radix 8), or hexadecimal (-x or-radix 16) numbers. - radix number supports only three numeric parameters (8, 10, 16). Total sizes are given in two decimal bases; decimal and hexadecimal outputs for-d or-x, or octal and hexadecimal outputs for-o.
Q4. How do I make the size command display the total size of all object files?
If you use size to find segment sizes for multiple files at once, you can also make it display the sum of column values by using the-t option.
size -t [file1] [file2] ...
Here is a screenshot of the execution of the command:
How to make size command show totals of all object files
The-t option adds the last line.
Q5. How do I get size to output the total size of common symbols in each file?
If you provide multiple input files for size and want it to show the size of common symbols in each file, you can include the-common option.
size --common [file1] [file2] ...
It should also be noted that when using Berkeley format, the size of these common symbols is incorporated into the bss size.
Q6: What other options are there?
In addition to the options just mentioned, size has some general command-line options, such as v (display version information) and-h (summary of optional parameters and options).
What are the other available command line options
Alternatively, you can use the @file option to have size read command-line options from a file. The following is a detailed explanation:
❝
The read option is inserted and replaced by the @file option. If the file does not exist or cannot be read, the option is not replaced but interpreted literally. Options in the file are separated by spaces. When an option contains spaces, enclose the entire option in single or double quotes. You can include any character (including the backslash itself) in an option by adding a backslash before the character. The file itself can also contain other @file options; any such options are processed recursively.
The above is "how to quickly get started Linux size command" all the content of this article, thank you for reading! Hope to share the content to help everyone, more relevant knowledge, welcome to pay attention to the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.