Essential cookies keep authentication working. With your permission, we also use analytics cookies to understand and improve the product. Read our Privacy Policy

DataEngPrep.tech
QuestionsPracticeAI CoachDashboardPricingBlog
ProLogin
Home/Questions/General/Other/How do you check the memory of your laptop using Linux commands?

How do you check the memory of your laptop using Linux commands?

General/Othereasy2 min read

Reviewed by Aditya Kumar · Last reviewed 2026-08-08

To check memory on a Linux laptop, the primary commands are free h for a summary of system memory usage and top (or htop ) to monitor per process memory consumption in real time. Mechanics / "Why"…

🤖 Analyze Your Answer
Frequency
Low
Asked at 1 company
Category
243
questions in General/Other
Difficulty Split
151E|43M|49H
in this category
Total Bank
1,863
across 7 categories
Asked at these companies
Coforge

Why This Question Matters

This easy-level General/Other question appears frequently in data engineering interviews at companies like Coforge. While less common, it tests deeper understanding that distinguishes strong candidates.

How to Approach This

Start by clearly defining the core concept being asked about. Interviewers want to see that you understand the fundamentals before diving into implementation details. Structure your answer with a definition, then explain the practical application with a concise example. The expert answer includes a code example that demonstrates the implementation pattern.

Expert Answer
369 wordsIncludes code

To check memory on a Linux laptop, the primary commands are free -h for a summary of system memory usage and top (or htop) to monitor per-process memory consumption in real-time.

Mechanics / "Why"

* free -h: This command provides a human-readable summary of total, used, free, shared, buff/cache, and available memory. The available column is crucial: it represents memory that can be allocated to new processes without the system needing to swap. This includes free memory plus reclaimable buff/cache.
* top / htop: These interactive tools display a dynamic view of running processes. Key memory metrics include VIRT (virtual memory size), RES (resident set size – actual physical memory used), and SHR (shared memory). They are invaluable for identifying memory-intensive applications or processes that might be leaking memory.
* /proc/meminfo: This file provides the most detailed, kernel-level information about memory usage, serving as the source for free. It lists various memory statistics like MemTotal, MemFree, Buffers, Cached, SwapTotal, etc.
* vmstat: Offers a report on virtual memory statistics, including memory paging (swapping in/out), which indicates memory pressure.
* ps aux --sort=-%mem | head -n 10: Lists the top 10 processes by memory usage, useful for quickly pinpointing memory hogs.

Concrete Example / Key Trade-offs

Understanding the available vs. free distinction is critical. A system might show very little free memory but plenty available because the kernel uses inactive memory for file caches (buff/cache), which can be instantly reclaimed. This is efficient.

free -h
              total        used        free      shared  buff/cache   available
Mem:           15Gi       5.0Gi       1.2Gi       200Mi       8.8Gi        9.5Gi
Swap:         2.0Gi       0.0Bi       2.0Gi
In this example, only 1.2Gi is free, but 9.5Gi is available for new applications, indicating healthy memory usage. For data engineers, this distinction is vital when troubleshooting Out-Of-Memory (OOM) errors in Spark executors or other memory-intensive jobs, where the system might be swapping heavily despite appearing to have "used" memory for caching.

In the interview, also mention…

When working with containers (e.g., Docker, Kubernetes for Spark executors), remember that free -h inside a container might show the host's memory. To see the container's actual memory limits and usage, you'd inspect cgroup metrics, typically found in /sys/fs/cgroup/memory/memory.stat or using container orchestration tools.

⚡
Pro Tip

Pro-Move: 'In K8s we use resource limits; free -h shows host. For pods: kubectl top pod. Saw OOM when limits too low.'

Want all answers as a PDF for offline study?
Seven focused volumes with 750+ in-depth answers — Answer Vault →

Related General/Other Questions

hardHave you worked on Data Warehousing projects?FreemediumHow would you read data from a web API? What steps would you follow after reading the data?FreehardRetrieve the most recent sale_timestamp for each product (Latest Transaction).FreehardWhat is the difference between OLTP and OLAP?FreemediumWhat is the difference between SQL and NoSQL databases?Free

Level up your prep

Recommended
Educative
Educative Unlimited

800+ hands-on courses — Grokking System Design, Coding Patterns, and AI mock interviews for your DE loop.

Start learning →

Some links below are affiliate links. If you buy through them we may earn a small commission at no extra cost to you — it helps keep DataEngPrep free.

According to DataEngPrep.tech, this is one of the most frequently asked General/Other interview questions, reported at 1 company. DataEngPrep.tech maintains an editor-reviewed database of 1,863 data engineering interview questions across 7 categories.

← Back to all questionsMore General/Other questions →
Categories
All QuestionsSQLSpark / Big DataPython / CodingSystem DesignCloud / ToolsBehavioral
By Company
AmazonGoogleDatabricksSnowflakeAWSAzureMicrosoftNetflixUberTCS
Interview Guides
All GuidesTop SQL QuestionsTop Spark QuestionsPySpark QuestionsTop Python QuestionsTop System DesignKafka QuestionsAirflow QuestionsSQL Window FunctionsETL QuestionsData Modeling
Products
AI Interview CoachAnswer AnalyzerSQL PlaygroundResume AnalyzerAnswer Vault PDFsPricing
Company
About & Editorial PolicyContact UsAI DisclosureDisclaimerTerms of ServicePrivacy Policy
© 2026 DataEngPrep.tech. All rights reserved.
AboutBlogContactDisclaimer