Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk4 min

How to Clear the Cache in Linux (Safely)

Use Linux’s drop_caches interface for a deliberate cold-cache test—not routine memory cleanup. Here’s what values 1, 2, and 3 do, the safe command, and common fixes.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To clear Linux’s documented filesystem caches for a test or debugging run, use sudo sh -c 'sync; echo 3 > /proc/sys/vm/drop_caches'. The value 3 requests dropping clean page-cache data and reclaimable filesystem metadata caches; it does not clear every application’s cache or free memory used by running processes. Linux normally reclaims these caches automatically when memory is needed, so routine cache clearing is usually unnecessary.

What the command clears—and what it does not

The kernel’s /proc/sys/vm/drop_caches interface applies to clean page-cache data and reclaimable slab objects such as dentries and inodes. It does not free dirty objects. The kernel describes this as a non-destructive operation: it discards eligible cached objects, which can later be rebuilt as needed. See the Linux Kernel Documentation for /proc/sys/vm/.

This is not a universal “clear all Linux cache” command. It does not empty application-managed caches or release memory held by processes. The interface is documented by the kernel; distributions may ship different kernel versions, so consult your distribution’s kernel documentation if you need version-specific confirmation.

Choose which cache category to drop

Value What it requests When it may fit
1 Page cache Testing or debugging behavior involving cached file contents.
2 Reclaimable slab objects, including dentries and inodes Testing or debugging filesystem metadata caches.
3 Both categories above A test that needs both documented groups dropped.

These values are the documented controls; they are not measures of how much memory will be freed. For details, see the kernel’s drop_caches documentation and the Linux man-pages project’s proc_sys_vm(5).

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Run the command

  1. Save work and close anything that should not be interrupted. Dropping caches is not destructive to stored data, but subsequent access may be slower while the kernel rebuilds cached data.
  2. Run the appropriate command in a terminal. For both documented categories, including the recommended sync first:
    sudo sh -c 'sync; echo 3 > /proc/sys/vm/drop_caches'
    For page cache only, use sudo sh -c 'sync; echo 1 > /proc/sys/vm/drop_caches'. For reclaimable dentries and inodes only, use sudo sh -c 'sync; echo 2 > /proc/sys/vm/drop_caches'.
  3. Enter your password if prompted. A successful write typically produces no terminal output. The command makes a request to drop eligible objects; it does not promise a particular amount of memory reclaimed.

Why use sync and sudo sh -c?

sync writes pending dirty data before the drop request, increasing the set of clean objects eligible to be dropped. The shell redirection also matters: sudo echo 3 > /proc/sys/vm/drop_caches can fail because your unprivileged shell, not echo, opens the procfs file. Running the shell through sudo sh -c elevates the shell that performs the redirection.

Should you clear caches?

Usually, no. A large cache figure by itself is not a reason to clear it: Linux uses memory for caches and automatically reclaims these objects when memory is needed elsewhere. Forcing a drop removes the performance benefit of caching, and rebuilding the caches can consume I/O and CPU. The kernel discourages using drop_caches outside testing or debugging; the man page likewise warns that losing caching benefits can degrade overall performance.

Use it when a test specifically needs a cold filesystem-cache condition, such as investigating filesystem behavior or memory-management behavior. For ordinary memory pressure, investigate the process or memory category involved rather than repeatedly dropping caches. The kernel says these objects are automatically reclaimed when memory is needed elsewhere (kernel documentation).

Troubleshooting

  • “Permission denied” or “Read-only file system”: Make sure the command uses sudo sh -c so the privileged shell performs the redirection. If the write is still rejected, the environment may restrict writes to this kernel interface; do not try to bypass that restriction.
  • The command prints nothing: That is normal for a successful shell write. No output is not a report of how much cache was dropped.
  • Memory usage does not fall as expected: The command only targets clean page cache and reclaimable slab objects. It does not free dirty objects or process memory, and the kernel may reclaim or rebuild caches as workload changes.
  • The system feels slower afterward: Cached data and metadata must be fetched or recreated again. This is an expected trade-off, not necessarily a failure; avoid cache drops during ordinary use.

Or skip the browser setup

For a different task—capturing a webpage as an image or PDF—ScreenshotNeo offers a one-request screenshot API. It is not a way to clear Linux filesystem caches. For a screenshot, for example:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo documentation for API options. Its captures can accept cookie banners and remove known consent platforms, newsletter popups and chat widgets before the shot; bot checks, blank pages and failed loads are not billed. It also has an MCP server for AI agents. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. Sign up for free.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Frequently Asked Questions

Does dropping Linux caches delete files?

No. It requests that eligible clean cached objects be dropped; it does not delete the underlying files.

Will this command clear browser or application caches?

No. Those caches are managed separately by the relevant applications.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. Shenzhen desk3 min
    HONOR Expands Beyond Smartphones With Humanoid Robot RevealHONOR said it unveiled its first humanoid robot at MWC 2026 and named shopping assistance, workplace inspections, and supportive companionship as intended uses. Later Robotics D1 claims and a reported…
  2. Cupertino desk5 min
    Apple Unveils AirPods Max 2: The Upgrade That Should Have Happened Years AgoAirPods Max 2 adds H2-powered audio features and Apple claims up to 1.5× more effective ANC, but its design, Smart Case, and 20-hour battery rating are unchanged. Wired lossless audio…
  3. Cupertino desk4 min
    Apple’s OLED Touch MacBooks Are Coming—but the Dynamic Island Is the Real GambleApple has not announced an OLED touchscreen MacBook, but reports point to high-end models arriving in late 2026 or early 2027. The reported Mac Dynamic Island could be useful, but…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.