One linux Command every day (45): free command

Source: Internet
Author: User
Tags touch command

One linux Command every day (45): free command link: One linux Command every day (1): ls command http://www.bkjia.com/ OS /201210/163049.html#linuxlinuxcommand every day (2): cd command serial (3 ): pwd command Export (4): mkdir command http://www.bkjia.com/ OS /201210/1620.3.html#a linuxcommand every day (5): rm command Export (6): rmdir command http://www.bkjia.com/ OS /201210/164017. Html; one linux Command every day (7): mv command running (8): cp command http://www.bkjia.com/ OS /201210/163164.html#a linuxcommand every day (9): touch command running (10): cat command running (11 ): nl command http://www.bkjia.com/ OS /201211/165990.htmla linuxcommand every day (12): more command http://www.bkjia.com/ OS /201211/165994.htmllinuxcommand every day (13): Less command restart (14): head command http://www.bkjia.com/ OS /201211/166191.htmllinuxcommand every day (15): tail command restart (16): which command restart (17): whereis command restart (18 ): locate command http://www.bkjia.com/ OS /201211/168895.htmla linuxcommand every day (19): find command overview h Ttp: // timeout (20): exechttp of the find command: // www.bkjia.com/ OS /201211/168901.htmllinuxcommand every day (21): xargshttp of the find command: // timeout (22 ): detailed description of the parameters of the find command: http://www.bkjia.com/ OS /201211/168912.htmla linuxcommand every day (23): Linux directory structure (24): Linux file type and extension (2 5): linux File Attribute explanation example (26): Use SecureCRT to upload and download files. Example (27): linux chmod command example (28): tar command http://www.bkjia.com/ OS /201212/172.161.html A linuxcommand every day (29 ): chgrp command http://www.bkjia.com/ OS /201212/172983.htmla linuxcommand every day (30): chown command http://www.bkjia.com/ OS /201212/173239.htmlone per day Linux Command (31):/etc/group file detailed explanation http://www.bkjia.com/ OS /201212/174429.htmlevery day a linuxcommand (32): gzip command running (33): df command running (34): du command running (35 ): ln command http://www.bkjia.com/ OS /201212/174993.htmla linuxlinuxcommand every day (36): diff command http://www.bkjia.com/ OS /201212/176333.htmllinuxcommand every day (37): da Te command serial (38): cal command serial (39): grep command http://www.bkjia.com/ OS /201212/177059.htmllinuxcommand every day (40): wc command serial (41): ps command serial (42 ): kill command http://www.bkjia.com/ OS /201212/177686.htmla linuxcommand every day (43): killall command http://www.bkj Ia.com/ OS /201212/178264.htmla linuxcommand every day (44): top Command http://www.bkjia.com/ OS /201212/179026.html free command can display Linux system idle, used physical memory and swap memory, and the buffer used by the kernel. In Linux system monitoring tools, the free command is one of the most frequently used commands. Www.2cto.com 1. command Format: free [parameter] 2. command function: the free command displays system usage and idle memory, including physical memory, interactive zone memory (swap), and kernel buffer memory. Shared memory will be ignored 3. Command Parameter:-B displays memory usage in bytes. -K displays memory usage in KB. -MB: memory usage is displayed in MB. -G displays memory usage in GB. -O does not display the buffer adjustment column. -S <interval seconds> continuous observation of memory usage. -T: displays the total memory column. -V displays the version information. 4. use instance: instance 1: Display memory usage command: freefree-gfree-m output: [root @ SF1150 service] # free total used free shared buffers cachedMem: 32940112 30841684 2098428 0 4545340-/+ buffers/cache: 11363424 14932920 Swap: 18007192 32764556 1944984 [root @ SF1150 service] # free-g total used free shared buffers cachedMem: 31 29 2 0 4 10-/+ buffers/cache: 14 17 Swap: 31 1 29 [root @ SF1150 service] # free-m total used free share D buffers cachedMem: 32168 30119 2048 0 4438 11097-/+ buffers/cache: 14583 17584 Swap: 31996 1899 30097 Note: The following is an explanation of these values: total: total physical memory size. Used: used. Free: available. Shared: The total memory Shared by multiple processes. Buffers/cached: disk cache size. Row 3 (-/+ buffers/cached): used. Free: available. The fourth line is SWAP partition SWAP, which is also known as virtual memory. Difference: used/free of the second row (mem) differs from used/free of the third row (-/+ buffers/cache. The difference between the two is that from the perspective of usage, the first line is from the OS perspective, because for OS, buffers/cached is used, so its available memory is 2098428KB, the memory used is 30841684KB, including the + buffers + cached used by the kernel (OS) + Application (X, oracle, etc. the third line indicates that, from the application perspective, for applications, buffers/cached is equivalent to available, because buffer/cached is designed to improve file read performance, when the application needs to use the memory, buffer/cached will be quickly recycled. From the application perspective, the available memory = system free memory + buffers + cached. For example, the available memory in the local machine is 18007156 = 2098428KB + 4545340KB + 11363424KB. Next, explain when the memory will be exchanged and by which side. When the available memory is less than the rated value, a meeting will be held for exchange. rating: Command: cat/proc/meminfo output: [root @ SF1150 service] # cat/proc/meminfoMemTotal: 32940112 kBMemFree: 2096700 kBBuffers: 4545340 kBCached: 11364056 kBSwapCached: 1896080 kBActive: 22739776 kBInactive: 7427836 kBHighTotal: 0 kBHighFree: 0 kBLowTotal: 32940112 kBLowFree: 2096700 kBSwapTotal: 32764556 kBSwapFree: 30819572 kBDirty: 164 kBWriteback: 0 kBAnonPages: 14153592 kBMapp Ed: 20748 kBSlab: 590232 kBPageTables: 34200 kBNFS_Unstable: 0 kBBounce: 0 kBCommitLimit: 49234612 kBCommitted_AS: 23247544 kBVmallocTotal: 34359738367 failed: 278840 failed: 34359459371 failed: Failed: 0 Hugepagesize: the 2048 kB switch reduces the number of physical pages used in the system in three ways: 1. reduce the size of the buffer and page cache, 2. swap out the V-type Memory Page. swap out or discard the page. (The Memory Page occupied by the Application, that is, the physical memory is insufficient ). In fact, using swap in a small amount affects the system performance. So what is the difference between buffers and cached? In order to improve disk access efficiency, Linux has made some careful designs, in addition to caching dentry (for VFS, accelerating the conversion of file path names to inode ), two major Cache methods are also adopted: Buffer Cache and Page Cache. The former is used to read and write disk blocks, and the latter is used to read and write inode files. These caches effectively shorten the time for I/O system calls (such as read, write, getdents. The operations on the www.2cto.com disk are logical (File System) and physical (Disk block). These two types of Cache are logical and physical data respectively. The Page cache is actually for the file system, and is the File cache. Data at the file level is cached in the page cache. The logic layer of the file needs to be mapped to the actual physical disk. This ing relationship is completed by the file system. When the page cache data needs to be refreshed, the data in the page cache is handed over to the buffer cache, because the Buffer Cache is the cache disk block. However, this kind of processing becomes simple after the kernel version 2.6, and there is no real cache operation. Buffer cache is the cache for disk blocks, that is, if no file system is available, data directly operated on the disk will be cached in the buffer cache. For example, the metadata of the file system is cached in the buffer cache. In short, page cache is used to cache file data, and buffer cache is used to cache disk data. In the case of a file system, operations on the file will cache the data to the page cache. If you directly use dd or other tools to read and write the disk, the data will be cached to the buffer cache. Therefore, in linux, as long as the swap space of swap is not used, we don't have to worry about having too little memory. if many swap instances are used, you may need to add physical memory. this is also the Standard for linux to check whether the memory is sufficient. if it is an application server, it generally only looks at the second row, + buffers/cache, that is, the free memory for the application is too small, it is also necessary to consider the optimization program or add memory. Instance 2: Display memory usage information in the form of sum command: free-t output: [root @ SF1150 service] # free-t total used free shared buffers cachedMem: 32940112 30845024 2095088 0 4545340 11364324-/+ buffers/cache: 14935360 18004752 Swap: 32764556 1944984 30819572 Total: 65704668 32790008 32914660 [root @ SF1150 service] # Note: instance 3: command for periodically querying memory usage information: www.2cto.com free-s 10 output: [root @ SF1150 service] # free-s 10 total used free shared buffers cachedMem: 32940112 30844528 2095584 4545340 11364380-/+ buffers/cache: 14934808 18005304 Swap: 32764556 1944984 30819572 total used free shared buffers cachedMem: 32940112 30843932 2096180 4545340 11364388-/+ buffers/cache: 14934204 18005908 Swap: 32764556 1944984 30819572 Note: The command is executed every 10 s.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.