What is the correct flag to use with the free command to display memory in gigabytes and megabytes?

Disable ads (and more) with a premium pass for a one time $4.99 payment

Boost your Linux skills with the CompTIA Linux+ Certification Exam simulator. Engage with multiple choice questions and detailed feedback. Master Linux concepts and prepare for your exam with confidence!

The free command is used in Linux to display the amount of free and used memory in the system. The flag that allows the output to be presented in a human-readable format, which means it will display memory sizes in bytes, kilobytes, megabytes, and gigabytes as appropriate, is the -h flag.

When using the -h option, the free command automatically adjusts the size unit to the most suitable one for the value being displayed, making it easier for users to interpret the memory capacity at a glance. This is especially helpful because it avoids the need for manual conversions and provides a clear understanding of the memory status in more familiar units.

In contrast, the other flags have specific purposes: -g directs the output to display memory in gigabytes only, -m displays memory in megabytes, and -mb, while not a standard flag used with the free command, does not have a defined function in this context. Therefore, the -h flag is the correct choice for obtaining a flexible and easily digestible view of memory usage across various sizes.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy