Tag Info

Hot answers tagged

86

bash does cache the full path to a command. You can verify that the command you are trying to execute is hashed with the type command: $ type svnsync svnsync is hashed (/usr/local/bin/svnsync) To clear the entire cache: $ hash -r Or just one entry: $ hash -d svnsync For additional information, consult help hash and man bash.


54

Emptying the buffers cache If you ever want to empty it you can use this chain of commands. $ free && sync && echo 3 > /proc/sys/vm/drop_caches && free total used free shared buffers cached Mem: 1018916 980832 38084 0 46924 355764 -/+ buffers/cache: 578144 ...


45

Not grep as such, but the filesystem itself often caches recently read data, causing later runs to go faster since grep is effectively searching in memory instead of disk.


22

There is no need to do this, the kernel manages RAM efficiently by using it for caches and buffers if it is not needed by processes. If processes request more RAM the kernel will deallocate caches and buffers if necessary to satisfy the request. This ServerFault answer explains how to interpret the memory usage reported by free.


21

From http://www.lindevdoc.org/wiki//var/cache Sorry for the (very) late answer, but I believe it's important to include this bit for future reference. Highlighted the bit which does answer this question. The /var/cache directory contains cached files, i.e. files that were generated and can be re-generated any time, but they are worth storing to save ...


18

Use this Bash script to get a list with all temporarily saved Flash videos: #!/usr/bin/env bash for flashpid in $(pgrep -f flashplayer.so); do cd "/proc/$flashpid/fd" for video in $(file * | grep '/tmp/Flash' | sed 's/\(^[0-9]*\).*/\1/g'); do echo "/proc/$flashpid/fd/$video" done done Mark the script as executable and run, for example ...


16

To clear just one entry you need a different flag: hash -d svnsync The -r flag doesn't take a parameter and will always delete the entire cache. (At least in bash 3.2.39 on Debian Lenny)


14

Linux and *NIX systems make use of various caches which sit between the filesystems (abstracted through VFS) and the user level processes. So it's not grep and it's not the filesystem doing the caching - it's the operating system. The cache which is responsible for your grep performance is the VFS Buffer Cache. Other caches are for inodes and directories ...


14

Bcache could be exactly what you're looking for: Bcache is a Linux kernel block layer cache. It allows one or more fast disk drives such as flash-based solid state drives (SSDs) to act as a cache for one or more slower hard disk drives. I'm eagerly awaiting its inclusion into Linux mainline, but unfortunately it's still not quite there. Some nice and ...


14

No, it doesn't. The issue isn't with the type of disk (spinning/non-spinning), it's with committing disk buffers from RAM to disk. If the power goes out suddenly, some of these buffers may never get committed to disk, and having barriers enabled improves your chances of recovering the filesystem. There's also an additional issue with the disk's on-board ...


10

Potential Method #1 - F_DROP_CACHES I found a method from 2012 that discusses a proposed patch to the Linux kernel in this mail thread titled: Re: [RFC Patch] fs: implement per-file drop caches. excerpt Cong> This is a draft patch of implementing per-file drop caches. Interesting. So can I do this from outside a process? I'm a SysAdmin, so my ...


9

Zram creates a block device backed by compressed ram. You can use that block device for swap. Normally memory pressure first results in the cache being discarded, and only after most of the cache has been freed up and memory is still tight does the system start swapping. CleanCache allows pages from the page cache to be migrated to a back end, such as xen ...


9

After some more research, I have found that the term SwapCached in /proc/meminfo is misleading. In fact, it relates to the number of bytes that are simultaneous in memory and swap, such that if these pages are not dirty, they do not need to be swapped out.


9

I don't think you can, easily, tell it "temporarily stop caching". But what you can do is tell the system to drop the cache before each run: As root: sync; echo 3 > /proc/sys/vm/drop_caches (This is documented in the kernel docs at Documentation/sysctl/vm.txt, which is handy if like some of us you can't always remember offhand what the values 1, 2, or ...


9

What you are seeing when you rerun a du command is the effect of disk buffering. Once you read a block its disk buffer is kept in the buffer cache until that block is needed. For du you need to read the directory and the inode for each file in the directory. The du results are not cached in this case, but can be derived with far less disk IO. While it ...


9

No. For one, I believe that /var/cache/bind/ is the default directory where bind9 expects its zone files to be stored (at least on Debian; I don't know offhand if other distros follow suit) For another, according to this documentation, pacman (the package manager used by Arch linux) stores its package cache under /var/cache/pacman/pkg/ and it most likely ...


9

The first line of the free output lists: total Your total, physical (assuming no virtualization) memory used How much of that is currently used (by anything) free How much of that is completely free (not used at all) shared (never anything there, ignore that column) buffers Memory used by kernel buffers cached Memory used for cache The last two items, ...


9

According to the varnish documentation, it's varnishd -V


8

The reason why you are missing the cache hits is that dig queries the DNS directly. You can try and see whether the cache works with the getent command: getent hosts host.example.com Running a separate caching DNS is a good idea, but you should consider running it on the network level if possible. If each host cache the data separately they will still run ...


8

Use lscpu. It's in Debian package “util-linux”.


8

You don't need to do so. There are two possiblities, if there is something in the cache: it is needed again it is not needed again In the first case, it is better if it remains in RAM as long as possible, which means: another process needs the RAM. Then it is discarded automatically without your intervention. In the second case, it doesn't disturb. ...


8

Well, in short: a warm cache is useful whereas a cold cache is not. In fact, a cold cache can be dangerous to use. You see, the whole point of a cache is to keep oft-accessed data accessible. For instance a DNS cache will store locally the results of the name-resolutions that you've requested recently, and, when those same resolutions are requested again ...


7

As an addition to the above answer, also see https://lwn.net/Articles/454795 for a detailed explanation of the technology. From what I understand, zram will be superseded by frontswap, which is not yet in the mainline kernel but which has the advantage that no fixed swap size has to be configured. This will make it easy to enable both cleancache and ...


7

bchache might be what you are looking for. It can act as write through or write back cache. ZFS and Btrfs also have features to put more often used blocks on flash storage.


6

Check these items, and see if any work for you: On the client, if you're not already using the cto option in the options column of the /etc/fstab line for your NFS filesystem, add it. cto tells the nfs client to open files via close-to-open, which makes them refresh the file whenever they open it. On the server, make sure your filesystem is exported with ...


6

Your mysqld is configured to use 1,8 GB of RAM - propably due to your settings in /etc/my.cnf. This is much more than is physically available. Now in some point of time (you might install sysstat and ask sar about that) you seem to get memory requests (might be PHP, too) that use more RAM than is available - so the systems starts to swap. At the end of ...


6

To control how Linux caches things refer to this https://www.kernel.org/doc/Documentation/sysctl/vm.txt In particular look at vfs_cache_pressure, you probably want a really low value or maybe even zero (1 sounds a bit safer to me though): vfs_cache_pressure ------------------ Controls the tendency of the kernel to reclaim the memory which is used for ...


5

There is none, and it really doesn't make sense anymore. ReadyBoost was useful for a short period of time when machines were RAM-limited, drives were slow, and flash was cheap. With RAM so cheap now, it makes much more sense to use RAM instead. Typical flash drives these days have write speeds of only about 5MB/s and read speeds of about 20MB/s. Compare ...


5

If you can arrange for the different hierarchies of files to belong to different groups, you can set up disk quotas. Don't give an upper limit (or make it the size of the disk) unless you want one. You'll still be able to tell instantly how much of its (effectively infinite) quota the group is using. This does require that your filesystem supports per-group ...


5

free pulls its data from /proc/meminfo slkwr133701:/usr/src/linux # free total used free shared buffers cached Mem: 2053456 434572 1618884 0 77888 201820 slkwr133701:/usr/src/linux # cat /proc/meminfo MemTotal: 2053456 kB MemFree: 1618736 kB Buffers: 77928 kB .... ...



Only top voted, non community-wiki answers of a minimum length are eligible