🍪

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

DDataEngPrep.tech
Home
PricingBlog
Sign InStart Free→
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
Reported in Interview Loops AtClick to view company-specific questions
🏢 Coforge Interview Hub→

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?
7-Volume Data Engineering Answer Vault (750+ Answers) or Complete Master Vault →
Instant PDF

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 →
Topic Hubs
All Topic Hubs (12 Competencies) →All 1,863+ QuestionsSQL Interview QuestionsApache Spark QuestionsPySpark QuestionsPython for Data EngineersSystem Design InterviewData Modeling & WarehousingStreaming (Kafka/Flink)SQL Window FunctionsETL Pipeline Design
Company Hubs
All Company Hubs (100+ Companies) →AmazonGoogleMetaDatabricksSnowflakeNetflixUberStripeMicrosoftAppleGoldman SachsAWS Engineering
Academies & Guides
All Guides & ArticlesData Engineering AcademyForward Deployed AI AcademyClient Simulation StudioApache Airflow QuestionsAzure Data EngineerBehavioral & STAR MethodCloud & Distributed Tools
AI Tools & Products
Answer Analyzer (Free)AI Mock InterviewsSQL PlaygroundATS Resume AnalyzerOffline PDF Answer VaultsMembership & Pricing
Company
About & Editorial PolicyContact UsAI DisclosureDisclaimerTerms of ServicePrivacy Policy
© 2026 DataEngPrep.tech. All rights reserved.
AboutBlogContactDisclaimer