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.2cto.com/os/201210/163049.html ; One linux command every day (2): cd command http://www.2cto.com/os/201210/163050.html One linux command every day (45): free command link: One linux command every day (1): ls command http://www.2cto.com/os/201210/163049.html ; One linux command every day (2): cd command http://www.2cto.com/os/201210/163050.html ; One linux command every day (3): pwd command http://www.2cto.com/os/201210/163462.html ; One linux command every day (4): mkdir command http://www.2cto.com/os/201210/163463.html ; One linux command every day (5): rm command http://www.2cto.com/os/201210/163662.html ; One linux command (6) every day: rmdir command http://www.2cto.com/os/201210/164017.html ; One linux command (7) every day: mv command http://www.2cto.com/os/201210/164247.html ; One linux command every day (8): cp command http://www.2cto.com/os/201210/164254.html ; One linux command every day (9): touch Command http://www.2cto.com/os/201211/165699.html ; One linux command every day (10): cat command http://www.2cto.com/os/201211/165989.html ; One linux command every day (11): nl command http://www.2cto.com/os/201211/165990.html One linux command every day (12): more command http://www.2cto.com/os/201211/165994.html One linux command every day (13): less command http://www.2cto.com/os/201211/165998.html One linux command every day (14): head Command http://www.2cto.com/os/201211/166191.html One linux command every day (15): tail command http://www.2cto.com/os/201211/168702.html One linux command every day (16): which command http://www.2cto.com/os/201211/168890.html A linux command (17) every day: whereis command http://www.2cto.com/os/201211/168893.html One linux command (18) every day: locate command http://www.2cto.com/os/201211/168895.html One linux command every day (19): find command overview http://www.2cto.com/os/201211/168897.html One linux command every day (20): find command exec http://www.2cto.com/os/201211/168901.html One linux command (21) every day: find command xargs http://www.2cto.com/os/201211/168903.html A linux command (22) every day: detailed description of the parameters of the find Command http://www.2cto.com/os/201211/168912.html A linux command (23) every day: Linux directory structure http://www.2cto.com/os/201211/170430.html One linux command every day (24): Linux file type and extension http://www.2cto.com/os/201211/170431.html One linux command every day (25): Explanation of linux file attributes http://www.2cto.com/os/201211/170434.html One linux command every day (26): use SecureCRT to upload and download files http://www.2cto.com/os/201211/172022.html One linux command every day (27): linux chmod command http://www.2cto.com/os/201211/172028.html One linux command every day (28): tar command http://www.2cto.com/os/201212/172641.html One linux command (29) every day: chgrp command http://www.2cto.com/os/201212/172983.html One linux command every day (30): chown command http://www.2cto.com/os/201212/173239.html A linux command (31) every day:/etc/group file details http://www.2cto.com/os/201212/174429.html One linux command (32) every day: gzip command http://www.2cto.com/os/201212/174431.html One linux command every day (33): df command http://www.2cto.com/os/201212/174434.html One linux command every day (34): du command http://www.2cto.com/os/201212/174701.html One linux command (35) every day: ln command http://www.2cto.com/os/201212/174993.html One linux command (36) every day: diff command http://www.2cto.com/os/201212/176333.html One linux command (37) every day: date Command http://www.2cto.com/os/201212/176335.html One linux command (38) every day: cal command http://www.2cto.com/os/201212/176337.html One linux command (39) every day: grep command http://www.2cto.com/os/201212/177059.html One linux command every day (40): wc command http://www.2cto.com/os/201212/177343.html One linux command every day (41): ps command http://www.2cto.com/os/201212/177665.html One linux command every day (42): kill Command http://www.2cto.com/os/201212/177686.html One linux command every day (43): killall command http://www.2cto.com/os/201212/178264.html One linux command every day (44): top Command http://www.2cto.com/os/201212/179026.html The free command can display idle and used physical memory, swap memory, and buffer used by the kernel in Linux. 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 <间隔秒数> Observe the memory usage continuously. -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.